Minimum value of a vector

Hi, I am a newbie to CUDA and just curious to know if there is any CUBLAS function which can find minimum element index in a given vector.

I found
“cublasIsamax”-finds the smallest index of the maximum magnitude element of single precision vector
but I couldn’t trace a function returning index for minimum magnitude ele.

Is there any? if yes, can you please post it or
if no, is there an efficient way to find index of minimum magnitude element in a given vector.

Appreciate your response

We are adding isamin to the list of functions implemented in CuBLAS.

Thank you mfatica.

Is there a way to perform minimum element index search in parallel??

Each block can find its own minimum ( and location) using the parallel data cache:

  1. each thread computes its local minimum and store the value in parallel data cache
  2. sync the threads
  3. compute local minimum of the block with a tree reduction (take a look at the scan example from the SDK)

You can perform the final reduction on the CPU.

If you are looking for a quick work around, multiply the original vector by -1 and look for the maximum. You can do it with BLAS function calls.

Thank you for your precious reply.

As cublasIsmax computes on magnitude i thought the sign does not matter. Is it true that the function considers the sign of the elements??

Right, I forgot Isamax is working on the magnitude.

You will need to write your own

Can i know when this function is expected to be included…a week from now? or later?

Time trial for the procedure is taking longer time…