int main(int argc, char** argv) {
  UCL_Device cop;
  std::cout << "Found " << cop.num_platforms() << " platform(s).\n";
  if (cop.num_platforms()>0) {
    std::cout << "Using platform: " << cop.platform_name() << std::endl;
    cop.print_all(std::cout);
  }
  return 0;
}
示例#2
0
文件: oclcc.cpp 项目: scicomp/geryon
int main(int argc, char* argv[])
{
   if(argc == 1) 
   {
      print_help();
      exit(EXIT_SUCCESS);
   }
   
   // Store all parameters in a vector
   std::vector<std::string> args;
   for(int i = 0; i < argc; i++)
   {
      args.push_back(argv[i]);
   }
   read_cmd(args);

   // Initialize device   
   std::cout << "Using platform: " << device.platform_name() << std::endl; 
   std::cout << "Setting to device ..." << target << std::endl;
   device.set(target);

   // Create compilation timer
   UCL_Timer timer;
   timer.init(device);
   timer.start();
   
   // Create program
   UCL_Program program(device);
   std::string log;
   int result = program.load(filename.c_str(), flags.c_str(), &log);
 
   // Check Compilation
   if(result != UCL_SUCCESS)
   {
      std::cerr << "Error: " << ucl_check(result) << " " << log << std::endl;
      exit(EXIT_FAILURE);
   }
   else
   {
      std::cout << "Compilation was successful" << std::endl;
      result = EXIT_SUCCESS;
   }
   
   // Stop compilation timer
   timer.stop();
   std::cout << timer.seconds() << " seconds." << std::endl;

   return result;
}