Package org.trifort.rootbeer.runtime

Examples of org.trifort.rootbeer.runtime.Rootbeer


  }
 
  private class CreateRootbeerThread implements Runnable {
    private Rootbeer m_rootbeer;
    public void run() {
      m_rootbeer = new Rootbeer();
    }
View Full Code Here


    List<Kernel> jobs = new ArrayList<Kernel>();
    for(int i = 0; i < size; ++i){
      jobs.add(new MMult(a, b, c, i, size));
    }

    Rootbeer rootbeer = new Rootbeer();
    rootbeer.run(jobs);
  }
View Full Code Here

  }
 
  private void test(TestSerialization creator, boolean print_mem) {
    int i = 0;
    try {     
      Rootbeer rootbeer = new Rootbeer();
      Configuration.setPrintMem(print_mem);
      List<Kernel> known_good_items = creator.create();
      List<Kernel> testing_items = creator.create();
      Stopwatch watch = new Stopwatch();
      watch.start();
      rootbeer.run(testing_items);
      m_passed = true;
      watch.stop();
      m_gpuTime = watch.elapsedTimeMillis();
      watch.start();
      for(i = 0; i < known_good_items.size(); ++i){      
View Full Code Here

  }

  private void test(TestKernelTemplate creator, boolean print_mem) {
    int i = 0;
    try {     
      Rootbeer rootbeer = new Rootbeer();
      Configuration.setPrintMem(print_mem);
      Kernel known_good_item = creator.create();
      Kernel testing_item = creator.create();
      ThreadConfig thread_config = creator.getThreadConfig();

      Stopwatch watch = new Stopwatch();
      watch.start();
      Context context = rootbeer.createDefaultContext();
      context.setKernel(testing_item);
      context.setThreadConfig(thread_config);
      context.buildState();
      context.run();
      context.close();
View Full Code Here

      m_passed = false;
    }
  }
 
  private void ex_test(TestException creator, boolean print_mem) {
    Rootbeer rootbeer = new Rootbeer();
    Configuration.setPrintMem(print_mem);
    List<Kernel> testing_items = creator.create();
    try {
      rootbeer.run(testing_items);
      m_passed = false;
      m_message = "No exception thrown when expecting one.";
    } catch(Throwable ex){
      m_passed = creator.catchException(ex);
      if(m_passed == false){
View Full Code Here

      }
    }
  }
 
  private void printDeviceInfo() {
    Rootbeer rootbeer = new Rootbeer();
    List<GpuDevice> devices = rootbeer.getDevices();
    System.out.println("device count: "+devices.size());
    for(GpuDevice device : devices){
      System.out.println("device: "+device.getDeviceName());
      System.out.println("  compute_capability: "+device.getMajorVersion()+"."+device.getMinorVersion());
      System.out.println("  total_global_memory: "+device.getTotalGlobalMemoryBytes()+" bytes");
View Full Code Here

    private Rootbeer m_rootbeer;
   
    public ChangeThread(TestSerialization creator, boolean print_mem){
      m_creator = creator;
      m_printMem = print_mem;
      m_rootbeer = new Rootbeer();
    }
View Full Code Here

    int[][] array = new int[outerCount][];
    for(int i = 0; i < outerCount; ++i){
      array[i] = newArray(size);
    }

    Rootbeer rootbeer = new Rootbeer();
    List<GpuDevice> devices = rootbeer.getDevices();
    GpuDevice device0 = devices.get(0);
    Context context0 = device0.createContext(4212880);
    context0.setCacheConfig(CacheConfig.PREFER_SHARED);
    context0.setThreadConfig(sizeBy2, outerCount, outerCount * sizeBy2);
    context0.setKernel(new GPUSortKernel(array));
View Full Code Here

    List<Kernel> tasks = new ArrayList<Kernel>();
    for(int index = 0; index < array.length; ++index){
      tasks.add(new ScalarAddKernel(array, index));
    }

    Rootbeer rootbeer = new Rootbeer();
    rootbeer.run(tasks);
  }
View Full Code Here

  private void gpuRun(){
    m_gpuWatch.start();
    MatrixKernel matrix_kernel = new MatrixKernel(m_a, m_bgpu, m_cgpu, m_blockSize,
      m_gridSize, m_blockIters);
    Rootbeer rootbeer = new Rootbeer();
    ThreadConfig thread_config = new ThreadConfig(1024, m_gridSize, 1024 * m_gridSize);
    rootbeer.run(matrix_kernel, thread_config);
    m_gpuWatch.stop();
    System.out.println("avg gpu time: "+m_gpuWatch.getAverageTime()+" ms");

    List<Calculation> calc_list = matrix_kernel.m_calcList.getList();
    for(Calculation calc : calc_list){
View Full Code Here

TOP

Related Classes of org.trifort.rootbeer.runtime.Rootbeer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.