2016-10-03 46 views

回答

0

答案是否定的,如2016年11月26日,Cudafy.NET不支持volatile关键字。但是,您可以将Cudafy.NET放到允许某些情况下。

例:

//declare a dummy in global scope 
public static int[] volatileArray = new int[256]; 
[Cudafy] 
private static void doStuffOnGPU(GThread thread, int[] output) 
{ 
    //use the GThread.InsertCode() function to declare in CUDA 
    GThread.InsertCode("__shared__ volatile int volatileArray[256];"); 
    //do a whole bunch of stuff 
} 

这段代码时将使用的测试顺序运行全局声明,并且将使用GPU上的挥发性声明。

相关问题