Find max/min in CUDA without passing it to the CPU

前端 未结 2 1215
一向
一向 2021-01-24 08:07

I need to find the index of the maximum element in an array of floats. I am using the function \"cublasIsamax\", but this returns the index to the CPU, and this is slowing down

2条回答
  •  心在旅途
    2021-01-24 08:40

    If you want to use CUBLAS and you have a GPU with compute capability 3.5 (K20, Titan) than you can use CUBLAS with dynamic parallelism. Than you can call CUBLAS from within a kernel on the GPU and no data will be returned to the CPU. If you have no device with cc 3.5 you will probably have to implement a find max function by yourself or look for an aditional library.

提交回复
热议问题