cudaMemset run by kernel or DMA (Direct memory access)

Hi all,

I have a question,
cudaMemset run by kernel or DMA (direct memory access)
please help me answer this question

thanks,
cucumber

You should be able to find out by running a simple test program with the CUDA profiler. On my system with CUDA 6.5, the following shows a kernel being run.

#include <stdio.h>
#include <stdlib.h>

// Macro to catch CUDA errors in CUDA runtime calls
#define CUDA_SAFE_CALL(call)                                          \
do {                                                                  \
    cudaError_t err = call;                                           \
    if (cudaSuccess != err) {                                         \
        fprintf (stderr, "Cuda error in file '%s' in line %i : %s.\n",\
                 __FILE__, __LINE__, cudaGetErrorString(err) );       \
        exit(EXIT_FAILURE);                                           \
    }                                                                 \
} while (0)

int main (void)
{
    float *test = 0;
    CUDA_SAFE_CALL (cudaMalloc ((void**)&test, 100));
    CUDA_SAFE_CALL (cudaMemset (test, 0, 100));
    CUDA_SAFE_CALL (cudaFree (test));
    return EXIT_SUCCESS;
}

The profiler log shows:

# NV_Warning: The legacy Command Line Profiler is deprecated and will be no longer available as of the next major release of the CUDA toolkit. Please use nvprof.
# CUDA_PROFILE_LOG_VERSION 2.0
# CUDA_DEVICE 0 Quadro 2000
# CUDA_CONTEXT 1
# TIMESTAMPFACTOR 13f2e81a05c2b6f0
method,gputime,cputime,occupancy
method=[ memset32_post ] gputime=[ 5.184 ] cputime=[ 10.263 ] occupancy=[ 0.333 ]

Hi njuffa,

Thanks for your answer.

Best Regards,
cucumber