int main( int argc, char** argv )
{
	if ( argc != 2 ) {
		printf( "Usage: %s file.cl\n", argv[0] );
		exit(1);
	}
	
	CL_MAGMA_RT *runtime = CL_MAGMA_RT::Instance();
	runtime->Init();
	
	uint i;
	cl_platform_id arch_compiling = NULL;
	for(i = 0; i < runtime->GetNumPlatform(); i++){
	  
		arch_compiling = runtime->SetPlatform(i, CL_DEVICE_TYPE_GPU);
	  
	  if (arch_compiling != NULL) runtime->CompileFile( argv[1] );
	  
	  arch_compiling = runtime->SetPlatform(i, CL_DEVICE_TYPE_CPU);
	  
	  if (arch_compiling != NULL) runtime->CompileFile( argv[1] );
	  
	  arch_compiling = NULL;
	}
	
	runtime->Quit();

	return 0;
}
Esempio n. 2
0
int main()
{
    CL_MAGMA_RT runtime;
    
    runtime.Init();
    
#ifdef TEST_COMPILE
    runtime.CompileSourceFiles("clfiles");
    runtime.Quit();
    runtime.Init();
#endif
    
    runtime.BuildFromBinaries("sinplace_transpose.co");
    runtime.BuildFromBinaries("stranspose-v2.co");
    runtime.BuildFromBinaries("stranspose.co");
    runtime.BuildFromBinaries("spermute-v2.co");
    
    bool ret;
    ret = runtime.CreateKernel("sinplace_T_even_kernel");
    if (ret==false)
        printf ("error creating kernel sinplace_T_even_kernel\n");
    ret = runtime.CreateKernel("sinplace_T_odd_kernel");
    if (ret==false)
        printf ("error creating kernel sinplace_T_odd_kernel\n");
        
    // remove this when finishing debugging
    ret = runtime.CreateKernel("myslaswp2");
    if (ret==false)
        printf ("error creating kernel sinplace_T_odd_kernel\n");
    /////////////////////////////////////////
    
    // test even size
    int M=1024;
    int offset = 0;
    test_transpose (M, offset, &runtime);
    
    // test odd size
    M=1024+32;
    test_transpose (M, offset, &runtime);
    return 0;
}