I am using MPS with GTX 1070. The below code doesn’t work when MPS is enabled (get error “operation not supported” when trying to add callback to stream) but it works when MPS is not enabled.
for (int i = 0; i < count; i++) {
ret = gpuErrCheck(cudaStreamCreateWithFlags(&streams[i], cudaStreamDefault));
if (ret < 0)
goto err;
ret = gpuErrCheck(cudaStreamAddCallback(streams[i], stream_callback,
(void *)(uintptr_t)i, 0));
if (ret < 0)
goto err;
}
Any ideas why “cudaStreamAddCallback()” doesn’t work with MPS?
To enable MPS I am using following script:
#!/bin/bash
# the following must be performed with root privilege
export CUDA_VISIBLE_DEVICES="0"
nvidia-smi -i 0 -c EXCLUSIVE_PROCESS
nvidia-cuda-mps-control -d