Backup when mocu failed to allocate memory with error code : CUDA_ERROR_OUT_OF_MEMORY
use semaphore