OptiX does not check error code from setDevices


the following code:

QVector<int> list = vecDevices[index];
  m_context->setDevices( list.begin(), list.end() );
  cudaError_t error = cudaGetLastError();
  if(error != cudaSuccess)
    qDebug() << "error " << __FILE__ << ":" << __LINE__ << cudaGetErrorString(error);

outputs the following message.

error /home/ben/workspace/USSCudaLib/src/SceneWorld.cpp : 273 cannot set while device is active in this process

In my opinion setDevices (alias rtContextSetDevices) should’ve already catched the error and not my additional check afterwards.


Can you check the rtContextSetDevices return error code? Is it cudaSuccess?

Yes the return code is cudaSuccess (0).

Do you still get the error if you put a cudaThreadSynchronize before the optix::Context::setDevices call?