void GOMP_OFFLOAD_init_device (int n) { pthread_mutex_lock (&ptx_dev_lock); if (!nvptx_init () || ptx_devices[n] != NULL) { pthread_mutex_unlock (&ptx_dev_lock); return; } ptx_devices[n] = nvptx_open_device (n); instantiated_devices++; pthread_mutex_unlock (&ptx_dev_lock); }
bool GOMP_OFFLOAD_init_device (int n) { struct ptx_device *dev; pthread_mutex_lock (&ptx_dev_lock); if (!nvptx_init () || ptx_devices[n] != NULL) { pthread_mutex_unlock (&ptx_dev_lock); return false; } dev = nvptx_open_device (n); if (dev) { ptx_devices[n] = dev; instantiated_devices++; } pthread_mutex_unlock (&ptx_dev_lock); return dev != NULL; }