cudaErrorInitializationError when creating a context

Hi,

I have a triple GTX 1070 configuration running on Ubuntu 16.04 with the driver 367.57 and I am trying to access the 2nd out of 3 devices using CUDA 7.5.

I am wondering why this line would fail with cudaErrorInitializationError (3)

CUcontext ctx;
cuCtxCreate(&ctx, CU_CTX_SCHED_YIELD, 1);

whereas this appears to work fine:

CUcontext ctx;
cudaSetDeviceFlags(cudaDeviceScheduleYield);
cudaSetDevice(1);
cudaCtxGetCurrent(&ctx);

Any ideas?

Christian

I’m not able to reproduce the problem in my test setup:

$ nvidia-smi
Tue Jan 10 17:47:54 2017
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 367.44                 Driver Version: 367.44                    |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  TITAN X (Pascal)    On   | 0000:05:00.0     Off |                  N/A |
| 23%   37C    P8    16W / 250W |      2MiB / 12187MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+
|   1  TITAN X (Pascal)    On   | 0000:06:00.0     Off |                  N/A |
| 23%   39C    P8    16W / 250W |      2MiB / 12189MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+
|   2  TITAN X (Pascal)    On   | 0000:09:00.0     Off |                  N/A |
| 23%   36C    P8    16W / 250W |      2MiB / 12189MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+
|   3  TITAN X (Pascal)    On   | 0000:0A:00.0     Off |                  N/A |
| 23%   27C    P8     8W / 250W |      2MiB / 12189MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID  Type  Process name                               Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+
$ cat t76.cpp
#include <cuda.h>
#include <stdio.h>


int main(){

  CUcontext ctx;
  CUresult err = cuInit(0);
  if (err != CUDA_SUCCESS) printf("oops 1 : %d\n", (int)err);
  err = cuCtxCreate(&ctx, CU_CTX_SCHED_YIELD, 1);
  if (err != CUDA_SUCCESS) printf("oops 2 : %d\n", (int)err);
  return 0;
}

$ g++ -I/usr/local/cuda/include -L/usr/lib/x86_64-linux-gnu t76.cpp -o t76 -lcuda
$ ./t76
$

Ubuntu 14.04