If you are using CUDA_VISIBLE_DEVICES, the passed GPU indices will be mapped to indices starting at 0 in your script.
E.g. if you are using:
CUDA_VISIBLE_DEVICES=2,3 python train1.py

you would have to use 'cuda:0' and 'cuda:1' inside train1.py instead of 'cuda:2' and 'cuda:3'.
Could this be the issue in your script?