#pragma warning disable IDE0002 // Simplify Member Access // Access cannot be simplified (dotnetcore build) private static CudaAPI InitializeAPI() { CudaAPI result; try { if (DLLLoader.CurrentOSPlatform == Util.OSPlatform.Windows) { result = new CudaAPIWindows(); } else { result = new CudaAPIUnix(); } if (result.InitAPI() != CudaError.CUDA_SUCCESS) { result = new NotSupportedCudaAPI(); } } catch (Exception ex) when(ex is DllNotFoundException || ex is EntryPointNotFoundException) { // In case of a critical initialization exception // fall back to the not supported Cuda api. result = new NotSupportedCudaAPI(); } return(result); }
#pragma warning disable IDE0002 // Simplify Member Access // Access cannot be simplified (.Net Core build) private static CudaAPI InitializeAPI() { CudaAPI result; if (Backends.Backend.RunningOnNativePlatform) { try { result = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? new CudaAPIWindows() as CudaAPI : new CudaAPIUnix() as CudaAPI; if (result.InitAPI() != CudaError.CUDA_SUCCESS) { result = new NotSupportedCudaAPI(); } } catch (Exception ex) when( ex is DllNotFoundException || ex is EntryPointNotFoundException) { // In case of a critical initialization exception // fall back to the not supported Cuda API. result = new NotSupportedCudaAPI(); } } else { // Not supported platform result = new NotSupportedCudaAPI(); } return(result); }