What(): cuda runtime error (3) : initialization error at /pytorch/aten/src/THC/THCGeneral.cpp:51

I start to run TensorFlow application on terminal. At the same time, when I start Pytorch application on another terminal I get error

THCudaCheck FAIL file=/pytorch/aten/src/THC/THCGeneral.cpp line=51 error=3 : initialization error
terminate called after throwing an instance of 'std::runtime_error'
  what():  cuda runtime error (3) : initialization error at /pytorch/aten/src/THC/THCGeneral.cpp:51

both Pytorch TensorFlow and running on different virtualenvs

My Environment
Ubuntu 18.04
GPU GeForce GTX 1060
Pytorch env (torch==1.1.0, torchvision==0.2.0)
Tensorflow env (tensorflow-gpu==1.15.0)

Pytorch application was running smoothly before starting tensorflow application

I stop the TensorFlow application but error not goes back

>>> torch.cuda.device_count()
>>> torch.cuda.is_available()

Starting tensorflow could not have done anything, I think. If you restart machine and if the pytorch env works then it might have been due to tensorflow. Also, try upgrading to latest pytorch version, maybe it was a bug that was fixed.