Rootbeer runtime error, how to fix?

家住魔仙堡 提交于 2019-12-20 06:39:10

问题


I'm learning to use Rootbeer, so I did the following things :

[1] Downloaded Rootbeer-1.2.3.jar

[2] Installed CUDA Toolkit and CUDA Driver from : http://www.nvidia.com/content/cuda/cuda-downloads.html

[3] Compiled the following sample program.

[4] Ran ArrayMultApp from NetBeans 8.0.2

import java.util.List;
import java.util.ArrayList;
import org.trifort.rootbeer.runtime.Kernel;
import org.trifort.rootbeer.runtime.Rootbeer;

public class ArrayMultApp
{
  public void multArray(int[] array)
  {
    List<Kernel> jobs=new ArrayList();
    for (int i=0;i<array.length;++i) jobs.add(new ArrayMult(array,i));
    Rootbeer rootbeer=new Rootbeer();
    rootbeer.run(jobs);
  }

  public static void main(String[] args)
  {
    ArrayMultApp app=new ArrayMultApp();
    int[] array=new int[10];
    for (int i=0;i<array.length;++i) array[i]=i;
    for (int i=0;i<array.length;++i) System.out.println("start array["+i+"]: "+array[i]);
    app.multArray(array);
    for (int i=0;i<array.length;++i) System.out.println("final array["+i+"]: "+array[i]);
  }
}

class ArrayMult implements Kernel
{
  private int[] m_source;
  private int m_index;

  public ArrayMult(int[] source,int index)
  {
    m_source=source;
    m_index=index;
  }

  public void gpuMethod()
  {
    m_source[m_index]*=11;
  }
}

But I got the following error message :

start array[0]: 0
start array[1]: 1
start array[2]: 2
start array[3]: 3
start array[4]: 4
start array[5]: 5
start array[6]: 6
start array[7]: 7
start array[8]: 8
start array[9]: 9
Exception in thread "main" java.lang.ClassCastException: ArrayMult cannot be cast to org.trifort.rootbeer.runtime.CompiledKernel
    at org.trifort.rootbeer.runtime.CUDAContext.setKernel(CUDAContext.java:119)Java Result: 1

I have Intel Core i7 x 980, NVIDA GeForce GTX 780, and Java 8 on Win 7 64 bit.

I copied the sample app from the Rootbeer site, why did I get the error message, and how to fix it ?

Edit : I forgot to mention one thing, during the installation, it said I didn't have Microsoft Visual Studio, something like that and said some parts about that was not installed, I thought I'm a Java developer, I don't need Visual Studio and I didn't mind not having those parts, could that be the problem ? Does that mean I have to buy and install Microsoft Visual Studio first before I can use Rootbeer for Java development ?

I followed instructions to go into [ C:\ProgramData\NVIDIA Corporation\CUDA Samples\v6.5\bin\win64\Release> ] and ran a lot of tests, they all work fine and I can see images being processed in small windows correctly.

When I tried to jar it, I got the following error :

C:\Dir_Rootbeer_Samples\dist>java -jar lib/Rootbeer-1.2.3.jar Rootbeer_Samples.jar Rootbeer_Samples-GPU.jar
warning: sm_12 and sm_11 not supported with recursion. use -norecursion to enable.
warning: sm_12 and sm_11 not supported with doubles. use -nodoubles to enable.
caching package names for: C:\Dir_Rootbeer_Samples\dist\Rootbeer_Samples.jar
cpool == null
java.lang.NullPointerException
        at soot.rbclassload.RootbeerClassLoader.loadHierarchySootClasses(RootbeerClassLoader.java:963)
        at soot.rbclassload.RootbeerClassLoader.loadNecessaryClasses(RootbeerClassLoader.java:294)
        at org.trifort.rootbeer.entry.RootbeerCompiler.setupSoot(RootbeerCompiler.java:198)
        at org.trifort.rootbeer.entry.RootbeerCompiler.compile(RootbeerCompiler.java:219)
        at org.trifort.rootbeer.entry.RootbeerCompiler.compile(RootbeerCompiler.java:213)
        at org.trifort.rootbeer.entry.Main.run(Main.java:208)
        at org.trifort.rootbeer.entry.Main.main(Main.java:244)
caching package names for: C:\Dir_Rootbeer_Samples\dist\lib\Rootbeer-1.2.3.jar
caching package names for: C:\Program Files\Java\jre1.8.0_20\lib\rt.jar
cpool == null
java.lang.NullPointerException
        at soot.rbclassload.RootbeerClassLoader.loadHierarchySootClasses(RootbeerClassLoader.java:963)
        at soot.rbclassload.RootbeerClassLoader.loadNecessaryClasses(RootbeerClassLoader.java:294)
        at org.trifort.rootbeer.entry.RootbeerCompiler.setupSoot(RootbeerCompiler.java:198)
        at org.trifort.rootbeer.entry.RootbeerCompiler.compile(RootbeerCompiler.java:219)
        at org.trifort.rootbeer.entry.RootbeerCompiler.compile(RootbeerCompiler.java:213)
        at org.trifort.rootbeer.entry.Main.run(Main.java:208)
        at org.trifort.rootbeer.entry.Main.main(Main.java:244)
caching package names for: Rootbeer_Samples.jar
cpool == null
java.lang.NullPointerException
        at soot.rbclassload.RootbeerClassLoader.loadHierarchySootClasses(RootbeerClassLoader.java:963)
        at soot.rbclassload.RootbeerClassLoader.loadNecessaryClasses(RootbeerClassLoader.java:294)
        at org.trifort.rootbeer.entry.RootbeerCompiler.setupSoot(RootbeerCompiler.java:198)
        at org.trifort.rootbeer.entry.RootbeerCompiler.compile(RootbeerCompiler.java:219)
        at org.trifort.rootbeer.entry.RootbeerCompiler.compile(RootbeerCompiler.java:213)
        at org.trifort.rootbeer.entry.Main.run(Main.java:208)
        at org.trifort.rootbeer.entry.Main.main(Main.java:244)
remapping class: java.util.concurrent.atomic.AtomicLong
java.lang.NullPointerException
        at soot.rbclassload.RootbeerClassLoader.remapClasses(RootbeerClassLoader.java:998)
        at soot.rbclassload.RootbeerClassLoader.loadNecessaryClasses(RootbeerClassLoader.java:295)
        at org.trifort.rootbeer.entry.RootbeerCompiler.setupSoot(RootbeerCompiler.java:198)
        at org.trifort.rootbeer.entry.RootbeerCompiler.compile(RootbeerCompiler.java:219)
        at org.trifort.rootbeer.entry.RootbeerCompiler.compile(RootbeerCompiler.java:213)
        at org.trifort.rootbeer.entry.Main.run(Main.java:208)
        at org.trifort.rootbeer.entry.Main.main(Main.java:244)

C:\Dir_Rootbeer_Samples\dist>

来源:https://stackoverflow.com/questions/27451001/rootbeer-runtime-error-how-to-fix

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!