Package org.trifort.rootbeer.testcases.rootbeertest.gpurequired

Source Code of org.trifort.rootbeer.testcases.rootbeertest.gpurequired.WhileTrueTest

/*
* Copyright 2012 Phil Pratt-Szeliga and other contributors
* http://chirrup.org/
*
* See the file LICENSE for copying permission.
*/

package org.trifort.rootbeer.testcases.rootbeertest.gpurequired;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicLong;

import org.trifort.rootbeer.runtime.Kernel;
import org.trifort.rootbeer.test.TestSerialization;

public class WhileTrueTest implements TestSerialization{

  public List<Kernel> create() {
    List<Kernel> ret = new ArrayList<Kernel>();
    AtomicLong along = new AtomicLong();
    for(int i = 0; i < 5; ++i){
      Kernel kernel = new WhileTrueRunOnGpu(along, i);
      ret.add(kernel);
    }
    return ret;
  }

  public boolean compare(Kernel original, Kernel from_gpu) {
    WhileTrueRunOnGpu lhs = (WhileTrueRunOnGpu) original;
    WhileTrueRunOnGpu rhs = (WhileTrueRunOnGpu) from_gpu;
    if(lhs.get().get() != rhs.get().get()){
      System.out.println("lhs: "+lhs.get().get());
      System.out.println("rhs: "+rhs.get().get());
      return false;
    }
    return true;
  }
 
}
TOP

Related Classes of org.trifort.rootbeer.testcases.rootbeertest.gpurequired.WhileTrueTest

TOP
Copyright © 2018 www.massapi.com. 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.