Using CUBLAS_STATUS_SUCCESS instead of cudaDeviceSynchronize?

Hi all, I am very new in CUDA and my question might be very silly.
I am using cublas library in my code and I want to use cublasSgemm function from this library. my question is that should I call cudaDeviceSynchronize function after calling this function (or any other built-in function)?

I saw an example which used the cublasSgemm like following:

cublasStatus_t stat;
stat = cublasSgemm(…);
return stat;

I know that CUBLAS_STATUS_SUCCESS means that operation completed successfully, does this mean that if (stat != CUBLAS_STATUS_SUCCESS) does the similar thing with cudaDeviceSynchronize?

I am very confused over this!

I appreciate any answer!


In general you should assume that CUBLAS functions are asynchronous. checking the return code of the function is not related to whether it is asynchronous or not.