What in simpleMultiGPU that indicates CPU multithreading?

Hi,

I’m now to CUDA. I’m trying to study multi-GPU code in CUDA 5. It is stated in readme.txt file the it includes multithreading. But I don’t see any line in the code that indicates multithreading. Anyone has any idea?

Thanks…

The host side multi-threading remark in the readme.txt file is probably a leftover from
past dark times in CUDA :)
In the past in order to work with MultiGPU you had to create a dedicated host thread per GPU.
Nowadays things are much easier and you can simple call cudaSetDevice() and on
the same host thread you can work with any GPU you want.

The remark you refer to in the readme file should probably be removed.

//Copy data to GPU, launch the kernel and copy data back. All asynchronously
    for (i = 0; i < GPU_N; i++)
    {
        //Set device
        checkCudaErrors(cudaSetDevice(i));

        //Copy input data from CPU
        checkCudaErrors(cudaMemcpyAsync(plan[i].d_Data, plan[i].h_Data, plan[i].dataN * sizeof(float), cudaMemcpyHostToDevice, plan[i].stream));

        //Perform GPU computations
        reduceKernel(plan[i].d_Sum, plan[i].d_Data, plan[i].dataN);
        getLastCudaError("reduceKernel() execution failed.\n");

        //Read back GPU results
        checkCudaErrors(cudaMemcpyAsync(plan[i].h_Sum_from_device, plan[i].d_Sum, ACCUM_N *sizeof(float), cudaMemcpyDeviceToHost, plan[i].stream));
    }

Oh, I see. Thank you very much, eyalhir74. =)