• K
    kevinchenkai

    #include <stdio.h>
    #include "cuda_runtime.h"
    
    __global__
    void helloFromGPU() {
        printf("hello from GPU\n");
    }
    
    
    int main(void)
    {
    
        float *dx;
        cudaMalloc(&dx, 1<<4*sizeof(float));
        printf("hello from cpu.\n");
        helloFromGPU<<<1, 10>>>();
        cudaDeviceSynchronize();
    }
    

    同步下就可以了

    发布在 社区求助区(SOS!!) 阅读更多

与 神力AI社区 的连接断开,我们正在尝试重连,请耐心等待