R and Partial Evaluation with Graal
Juan Fumero
juan.fumero at ed.ac.uk
Mon May 16 12:51:41 UTC 2016
Hi,
that's exactly what I was looking for. It works.
Thanks!
-juan
On Mon, 2016-05-16 at 12:53 +0200, Jeremie Miserez wrote:
> Hi,,
>
> The command-line I've been using is:
>
> mx --dynamicimport=graal-core --jdk jvmci r
>
> or rscript:
>
> mx --dynamicimport=graal-core --jdk jvmci rscript <path-to-script>
>
> If you add the -v flag you should see something
> "jvmci/jdk1.8.0_91/product/bin/java -server -d64" on the first line
> rather than "/usr/lib/jvm/java-8-oracle/bin/java -d64"
>
> To actually check if functions are being compiled, add the
> TraceTruffleCompilation option:
>
> mx --dynamicimport=graal-core --jdk jvmci --J
> "@-Dgraal.TraceTruffleCompilation=true" r
>
> You should see something like this after running a function a few
> times:
>
> [truffle] opt done <promise>
> <opt> |ASTSize 33/
> 33
> >
> > Time 3335(2290+1045)ms |DirectCallNodes I 0/D 0
> > |GraalNodes
> 536/ 630 |CodeSize 2156 |Source n/a
>
> Regards,
> Jeremie
>
>
>
> -------------------------------------------------------------------
> -----
>
> *From:* jaroslav.tulach at oracle.com
> *Sent:* Monday, May 16, 2016 11:26AM
> *To:* juan.fumero at ed.ac.uk
> *Cc:* graal-dev at openjdk.java.net
> *Subject:* Re: R and Partial Evaluation with Graal
>
> >
> > ### Monday 16 of May 2016, 09:57:16 @ Juan Fumero ###
> > >
> > > Hi Jaroslav,
> > > Thanks a lot for the suggestion.
> > >
> > > I get the same error unless I use the suggested flag in the VM. I
> > > understand this is the same that setting the JAVA_HOME to
> > > GraalVM.
> > But if you use the flag to suppress the error, what instance of
> > Truffle.getRuntime() do you get? The default one? That one is
> > slow...
> >
> > I don't know what to advice. Looking at the history
> > https://github.com/graalvm/truffle/commits/master/truffle/com.oracl
> > e.truffle.api/src/com/oracle/truffle/api/Truffle.java
> >
> > I don't see that many changes. I don't think the JDK9 related
> > changes could
> > cause much harm.
> > -jt
> >
> > >
> > > On Mon, 2016-05-16 at 09:06 +0200, Jaroslav Tulach wrote:
> > > >
> > > > Hello Juan,
> > > > I think you can choose your JDK with:
> > > >
> > > > fastr$ mx --java-home /path/to/graalvm R
> > > >
> > > > -jt
> > > >
> > > >
> > > > ### Sunday 15 of May 2016, 13:04:29 @ Juan Fumero ###
> > > >
> > > > >
> > > > > Hi all,
> > > > > I am using the R version [1] in github. I saw there is no
> > > > > dependency
> > > > > now with Graal-core. Just Truffle instead. My question is how
> > > > > to
> > > > > use
> > > > > now the Graal JVMCI compiler.
> > > > >
> > > > > I compile with the graal-core [2] compiler separately. But
> > > > > when I
> > > > > execute R I get this error:
> > > > >
> > > > > <error>
> > > > > $ mx R
> > > > > .....
> > > > > Exception in thread "main" java.lang.InternalError
> > > > >
> > > > > at
> > > > > com.oracle.truffle.api.Truffle$1.run(Truffle.java:103)
> > > > > at
> > > > > com.oracle.truffle.api.Truffle$1.run(Truffle.java:58)
> > > > > at java.security.AccessController.doPrivileged(Native
> > > > > Method)
> > > > > at
> > > > > com.oracle.truffle.api.Truffle.initRuntime(Truffle.java:58)
> > > > > at
> > > > > com.oracle.truffle.api.Truffle.<clinit>(Truffle.java:46)
> > > > > at
> > > > >
> > > > > com.oracle.truffle.api.impl.Accessor.<clinit>(Accessor.java:3
> > > > > 21)
> > > > >
> > > > > at
> > > > >
> > > > > com.oracle.truffle.api.vm.PolyglotEngine.<clinit>(PolyglotEng
> > > > > ine.ja
> > > > > va:1
> > > > > 07)
> > > > >
> > > > > at
> > > > >
> > > > > com.oracle.truffle.r.engine.shell.RCommand.readEvalPrint(RCom
> > > > > mand.j
> > > > > ava:
> > > > > 191)
> > > > >
> > > > > at
> > > > >
> > > > > com.oracle.truffle.r.engine.shell.RCommand.main(RCommand.java
> > > > > :85)
> > > > > Caused by: java.lang.reflect.InvocationTargetException
> > > > >
> > > > > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> > > > > Method)
> > > > > at
> > > > >
> > > > > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcces
> > > > > sorImp
> > > > > l.ja
> > > > > va:62)
> > > > >
> > > > > at
> > > > >
> > > > > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMet
> > > > > hodAcc
> > > > > esso
> > > > > rImpl.java:43)
> > > > >
> > > > > at java.lang.reflect.Method.invoke(Method.java:498)
> > > > > at
> > > > > com.oracle.truffle.api.Truffle$1.run(Truffle.java:100)
> > > > > ... 8 more
> > > > >
> > > > > Caused by: java.lang.NoClassDefFoundError:
> > > > > com/oracle/truffle/api/TruffleRuntimeAccess (suppress with
> > > > > -Djvmci.service.suppressNoClassDefFoundError=true)
> > > > >
> > > > > at
> > > > > jdk.vm.ci.services.Services$1.computeValue(Services.java:59)
> > > > >
> > > > > at
> > > > > jdk.vm.ci.services.Services$1.computeValue(Services.java:50)
> > > > >
> > > > > at
> > > > > java.lang.ClassValue.getFromHashMap(ClassValue.java:227)
> > > > > at
> > > > > java.lang.ClassValue.getFromBackup(ClassValue.java:209)
> > > > > at java.lang.ClassValue.get(ClassValue.java:115)
> > > > > at
> > > > > jdk.vm.ci.services.Services.loadSingle(Services.java:120)
> > > > > ... 13 more
> > > > >
> > > > > Caused by: java.lang.ClassNotFoundException:
> > > > > com.oracle.truffle.api.TruffleRuntimeAccess
> > > > >
> > > > > at
> > > > > java.net.URLClassLoader.findClass(URLClassLoader.java:381)
> > > > > at
> > > > > java.lang.ClassLoader.loadClass(ClassLoader.java:424)
> > > > > at
> > > > >
> > > > > java.net.FactoryURLClassLoader.loadClass(URLClassLoader.java:
> > > > > 814)
> > > > >
> > > > > at
> > > > > java.lang.ClassLoader.loadClass(ClassLoader.java:357)
> > > > > at java.lang.ClassLoader.defineClass1(Native Method)
> > > > > at
> > > > > java.lang.ClassLoader.defineClass(ClassLoader.java:763)
> > > > > at
> > > > >
> > > > > java.security.SecureClassLoader.defineClass(SecureClassLoader
> > > > > .java:
> > > > > 142)
> > > > >
> > > > > at
> > > > > java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
> > > > >
> > > > > at
> > > > > java.net.URLClassLoader.access$100(URLClassLoader.java:73)
> > > > > at
> > > > > java.net.URLClassLoader$1.run(URLClassLoader.java:368)
> > > > > at
> > > > > java.net.URLClassLoader$1.run(URLClassLoader.java:362)
> > > > > at java.security.AccessController.doPrivileged(Native
> > > > > Method)
> > > > > at
> > > > > java.net.URLClassLoader.findClass(URLClassLoader.java:361)
> > > > > at
> > > > > java.lang.ClassLoader.loadClass(ClassLoader.java:424)
> > > > > at
> > > > >
> > > > > java.net.FactoryURLClassLoader.loadClass(URLClassLoader.java:
> > > > > 814)
> > > > >
> > > > > at
> > > > > java.lang.ClassLoader.loadClass(ClassLoader.java:357)
> > > > > at jdk.vm.ci.services.Services.getServiceImpls(Native
> > > > > Method)
> > > > > at
> > > > > jdk.vm.ci.services.Services.access$000(Services.java:37)
> > > > > at
> > > > > jdk.vm.ci.services.Services$1.computeValue(Services.java:54)
> > > > >
> > > > > ... 18 more\
> > > > >
> > > > > </error>
> > > > >
> > > > > So I run with the option suggested in the error:
> > > > >
> > > > > $ mx -v R --J @'-
> > > > > Djvmci.service.suppressNoClassDefFoundError=true '
> > > > > myScript.R
> > > > >
> > > > > I can run FastR but, is this the use of the Partial
> > > > > Evaluator in
> > > > > Graal through the OptimizedCallTarget?
> > > > >
> > > > > [1] https://github.com/graalvm/fastr
> > > > > [2] https://github.com/graalvm/graal-core/commit/071173a4a612
> > > > > 47df08
> > > > > 26a0
> > > > > 1db20bf7b381f1bbfe
> > > > >
> > > > > Thanks
> > > > > -juan
>
--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.
More information about the graal-dev
mailing list