Merge branch 'hip' into 'master'
Hip See merge request sheepitrenderfarm/client!146
This commit is contained in:
@@ -23,8 +23,8 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import com.sheepit.client.Configuration;
|
||||
import com.sheepit.client.hardware.gpu.hip.HIP;
|
||||
import com.sheepit.client.hardware.gpu.nvidia.Nvidia;
|
||||
import com.sheepit.client.hardware.gpu.opencl.OpenCL;
|
||||
import com.sheepit.client.os.OS;
|
||||
import com.sheepit.client.os.Windows;
|
||||
|
||||
@@ -39,8 +39,9 @@ public class GPU {
|
||||
}
|
||||
|
||||
OS os = OS.getOS();
|
||||
if (os instanceof Windows) { // opencl detection will crash on Mac (and sometimes on Linux)
|
||||
gpus = new OpenCL().getGpus();
|
||||
if (os instanceof Windows) { // for now we only allow AMD on Windows
|
||||
|
||||
gpus = new HIP().getGpus();
|
||||
if (gpus != null) {
|
||||
devices.addAll(gpus);
|
||||
}
|
||||
|
||||
@@ -19,9 +19,6 @@
|
||||
|
||||
package com.sheepit.client.hardware.gpu;
|
||||
|
||||
import com.sheepit.client.hardware.gpu.nvidia.Nvidia;
|
||||
import com.sheepit.client.hardware.gpu.opencl.OpenCL;
|
||||
|
||||
public class GPUDevice {
|
||||
private String type;
|
||||
private String model;
|
||||
|
||||
217
src/main/java/com/sheepit/client/hardware/gpu/hip/HIP.java
Normal file
217
src/main/java/com/sheepit/client/hardware/gpu/hip/HIP.java
Normal file
@@ -0,0 +1,217 @@
|
||||
package com.sheepit.client.hardware.gpu.hip;
|
||||
|
||||
import com.sheepit.client.hardware.gpu.GPUDevice;
|
||||
import com.sheepit.client.hardware.gpu.GPULister;
|
||||
import com.sheepit.client.hardware.gpu.hip.data.HIPDeviceAttribute_t;
|
||||
import com.sheepit.client.hardware.gpu.hip.data.HIPDeviceProp_t;
|
||||
import com.sheepit.client.hardware.gpu.hip.data.HipError_t;
|
||||
import com.sheepit.client.os.Windows;
|
||||
import com.sun.jna.Native;
|
||||
import com.sun.jna.ptr.IntByReference;
|
||||
import oshi.SystemInfo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class HIP implements GPULister {
|
||||
|
||||
private static final String HIP_LIBRARY = "amdhip64";
|
||||
private static final String HIP_LIBRARY_LINUX = "libamdhip64.so"; //for potential future use
|
||||
private static final String MINIMAL_WINDOWS_DRIVER_VERSION = "30.0.15021.7000";
|
||||
public static final String TYPE = "HIP";
|
||||
|
||||
private HIPLib hip;
|
||||
|
||||
public HIP() {
|
||||
|
||||
}
|
||||
|
||||
public String getIdentifier(int deviceID) {
|
||||
|
||||
String deviceName = getDeviceName(deviceID);
|
||||
|
||||
int pciDeviceID, pciBusID, pciDomainID;
|
||||
pciBusID = getPciBusID(deviceID);
|
||||
pciDeviceID = getPciDeviceID(deviceID);
|
||||
pciDomainID = getPciDomainID(deviceID);
|
||||
|
||||
String deviceIdentifier = String.format("HIP_%s_%04x:%02x:%02x",
|
||||
deviceName,
|
||||
pciDomainID,
|
||||
pciBusID,
|
||||
pciDeviceID);
|
||||
|
||||
return deviceIdentifier;
|
||||
}
|
||||
|
||||
private long getDeviceMemory(int deviceID) {
|
||||
HIPDeviceProp_t deviceProperties = new HIPDeviceProp_t();
|
||||
int status = hip.hipGetDeviceProperties(deviceProperties, deviceID);
|
||||
if (status != HipError_t.HIP_SUCCESS) {
|
||||
System.err.println("Error retrieving name of device " + deviceID);
|
||||
return -1;
|
||||
}
|
||||
return deviceProperties.totalGlobalMem;
|
||||
}
|
||||
|
||||
public int getRuntimeVersion() {
|
||||
IntByReference version = new IntByReference();
|
||||
int result = hip.hipRuntimeGetVersion(version);
|
||||
if (result != HipError_t.HIP_SUCCESS) {
|
||||
System.err.println("Error");
|
||||
}
|
||||
return version.getValue();
|
||||
}
|
||||
|
||||
private String getDriverVersion() {
|
||||
SystemInfo info = new SystemInfo();
|
||||
var hardware = info.getHardware();
|
||||
var gpus = hardware.getGraphicsCards();
|
||||
|
||||
if (gpus.isEmpty() || getNumberOfDevices() == 0) {
|
||||
return null;
|
||||
}
|
||||
String driverVersion = "";
|
||||
for (var gpu : gpus) {
|
||||
if (gpu.getName().contains("AMD ")) {
|
||||
driverVersion = gpu.getVersionInfo();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
var tmp = driverVersion.split("=");
|
||||
if (tmp.length < 2) { //could not extract driver version number. Looking for a string like this: "DriverVersion=30.0.21017.1000"
|
||||
return null;
|
||||
}
|
||||
|
||||
String versionNumber = tmp[1];
|
||||
|
||||
return versionNumber;
|
||||
}
|
||||
|
||||
private int getNumberOfDevices() {
|
||||
IntByReference deviceCount = new IntByReference();
|
||||
int status = hip.hipGetDeviceCount(deviceCount);
|
||||
if (status != HipError_t.HIP_SUCCESS) {
|
||||
System.err.println("Error");
|
||||
return -1;
|
||||
}
|
||||
return deviceCount.getValue();
|
||||
}
|
||||
|
||||
public int getCurrentDeviceID() {
|
||||
IntByReference deviceID = new IntByReference();
|
||||
int status = hip.hipGetDevice(deviceID);
|
||||
if (status != HipError_t.HIP_SUCCESS) {
|
||||
System.err.println("Error");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return deviceID.getValue();
|
||||
}
|
||||
|
||||
public String getDeviceName(int deviceID) {
|
||||
HIPDeviceProp_t deviceProperties = new HIPDeviceProp_t();
|
||||
int status = hip.hipGetDeviceProperties(deviceProperties, deviceID);
|
||||
if (status != HipError_t.HIP_SUCCESS) {
|
||||
System.err.println("Error retrieving name of device " + deviceID);
|
||||
return null;
|
||||
}
|
||||
|
||||
return new String(deviceProperties.name).trim();
|
||||
}
|
||||
|
||||
private int getPciBusID(int deviceID) {
|
||||
IntByReference busID = new IntByReference();
|
||||
int status = hip.hipDeviceGetAttribute(busID, HIPDeviceAttribute_t.hipDeviceAttributePciBusId, deviceID);
|
||||
if (status != HipError_t.HIP_SUCCESS) {
|
||||
System.err.println("Error");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return busID.getValue();
|
||||
}
|
||||
|
||||
private int getPciDeviceID(int deviceID) {
|
||||
IntByReference id = new IntByReference();
|
||||
int status = hip.hipDeviceGetAttribute(id, HIPDeviceAttribute_t.hipDeviceAttributePciDeviceId, deviceID);
|
||||
if (status != HipError_t.HIP_SUCCESS) {
|
||||
System.err.println("Error");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return id.getValue();
|
||||
}
|
||||
|
||||
private int getPciDomainID(int deviceID) {
|
||||
IntByReference id = new IntByReference();
|
||||
int status = hip.hipDeviceGetAttribute(id, HIPDeviceAttribute_t.hipDeviceAttributePciDomainID+2, deviceID); //69 does not seem to be present on my installation. Tests conclude that its "likely" 71
|
||||
if (status != HipError_t.HIP_SUCCESS) {
|
||||
System.err.println("HIP::getPciDomainID::Error: " + status);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return id.getValue();
|
||||
}
|
||||
|
||||
@Override public List<GPUDevice> getGpus() {
|
||||
|
||||
try {
|
||||
this.hip = (HIPLib) Native.load(HIP_LIBRARY, HIPLib.class);
|
||||
}
|
||||
catch (java.lang.UnsatisfiedLinkError e) {
|
||||
System.out.println("HIP::getGpus failed(A) to load HIP lib (path: " + HIP_LIBRARY + ")");
|
||||
return null;
|
||||
}
|
||||
catch (java.lang.ExceptionInInitializerError e) {
|
||||
System.out.println("HIP::getGpus failed(B) ExceptionInInitializerError " + e);
|
||||
return null;
|
||||
}
|
||||
catch (Exception e) {
|
||||
System.out.println("HIP::getGpus failed(C) generic exception " + e);
|
||||
return null;
|
||||
}
|
||||
|
||||
List<GPUDevice> gpuDevices = new ArrayList<>();
|
||||
|
||||
int numberOfDevices = getNumberOfDevices();
|
||||
if (numberOfDevices < 1) {
|
||||
return null;
|
||||
}
|
||||
|
||||
//check that the driver is capable
|
||||
long driverVersionAsLong = -1;
|
||||
String driverVersion = "";
|
||||
try {
|
||||
driverVersion = getDriverVersion();
|
||||
if (driverVersion == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
driverVersionAsLong = Long.parseLong(driverVersion.replace(".", ""));
|
||||
long minimumVersionAsLong = Long.parseLong(MINIMAL_WINDOWS_DRIVER_VERSION.replace(".",""));
|
||||
|
||||
if (driverVersionAsLong < minimumVersionAsLong) {
|
||||
System.out.println("HIP::getGpus AMD driver too old");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
catch (NumberFormatException e) {
|
||||
System.out.println("HIP::getGpus Unable to convert driver version to long: " + driverVersion + ". Exception: " + e.getMessage());
|
||||
return null;
|
||||
}
|
||||
|
||||
int numberedID = 0;
|
||||
for (int i = 0; i < numberOfDevices; i++) {
|
||||
String deviceName = getDeviceName(i);
|
||||
long vram = getDeviceMemory(i);
|
||||
String deviceIdentifier = getIdentifier(i);
|
||||
String oldID = TYPE + "_" + numberedID;
|
||||
GPUDevice device = new GPUDevice(TYPE, deviceName, vram, deviceIdentifier, oldID);
|
||||
gpuDevices.add(device);
|
||||
numberedID++;
|
||||
}
|
||||
|
||||
return gpuDevices;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.sheepit.client.hardware.gpu.hip;
|
||||
|
||||
import com.sheepit.client.hardware.gpu.GPUDevice;
|
||||
import com.sheepit.client.hardware.gpu.GPULister;
|
||||
import com.sheepit.client.hardware.gpu.hip.data.HIPDeviceProp_t;
|
||||
import com.sun.jna.Library;
|
||||
import com.sun.jna.ptr.IntByReference;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface HIPLib extends Library {
|
||||
|
||||
int hipGetDeviceCount(IntByReference numDevices);
|
||||
int hipRuntimeGetVersion(IntByReference version);
|
||||
int hipDriverGetVersion(IntByReference driverVersion);
|
||||
int hipGetDeviceProperties(HIPDeviceProp_t props, int deviceID);
|
||||
int hipGetDevice(IntByReference deviceID);
|
||||
|
||||
int hipDeviceGetAttribute(IntByReference pi, int hipDeviceAttribute_t, int deviceID);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,132 @@
|
||||
package com.sheepit.client.hardware.gpu.hip.data;
|
||||
|
||||
public interface HIPDeviceAttribute_t {
|
||||
public static final int hipDeviceAttributeCudaCompatibleBegin = 0;
|
||||
public static final int hipDeviceAttributeEccEnabled = hipDeviceAttributeCudaCompatibleBegin; ///< Whether ECC support is enabled.
|
||||
public static final int hipDeviceAttributeAccessPolicyMaxWindowSize = 1; ///< Cuda only. The maximum size of the window policy in bytes.
|
||||
public static final int hipDeviceAttributeAsyncEngineCount = 2; ///< Cuda only. Asynchronous engines number.
|
||||
public static final int hipDeviceAttributeCanMapHostMemory = 3; ///< Whether host memory can be mapped into device address space
|
||||
public static final int hipDeviceAttributeCanUseHostPointerForRegisteredMem = 4;///< Cuda only. Device can access host registered memory
|
||||
///< at the same virtual address as the CPU
|
||||
public static final int hipDeviceAttributeClockRate = 5; ///< Peak clock frequency in kilohertz.
|
||||
public static final int hipDeviceAttributeComputeMode = 6; ///< Compute mode that device is currently in.
|
||||
public static final int hipDeviceAttributeComputePreemptionSupported = 7; ///< Cuda only. Device supports Compute Preemption.
|
||||
public static final int hipDeviceAttributeConcurrentKernels = 8; ///< Device can possibly execute multiple kernels concurrently.
|
||||
public static final int hipDeviceAttributeConcurrentManagedAccess = 9; ///< Device can coherently access managed memory concurrently with the CPU
|
||||
public static final int hipDeviceAttributeCooperativeLaunch = 10; ///< Support cooperative launch
|
||||
public static final int hipDeviceAttributeCooperativeMultiDeviceLaunch = 11; ///< Support cooperative launch on multiple devices
|
||||
public static final int hipDeviceAttributeDeviceOverlap = 12; ///< Cuda only. Device can concurrently copy memory and execute a kernel.
|
||||
///< Deprecated. Use instead asyncEngineCount.
|
||||
public static final int hipDeviceAttributeDirectManagedMemAccessFromHost = 13; ///< Host can directly access managed memory on
|
||||
///< the device without migration
|
||||
public static final int hipDeviceAttributeGlobalL1CacheSupported = 14; ///< Cuda only. Device supports caching globals in L1
|
||||
public static final int hipDeviceAttributeHostNativeAtomicSupported = 15; ///< Cuda only. Link between the device and the host supports native atomic operations
|
||||
public static final int hipDeviceAttributeIntegrated = 16; ///< Device is integrated GPU
|
||||
public static final int hipDeviceAttributeIsMultiGpuBoard = 17; ///< Multiple GPU devices.
|
||||
public static final int hipDeviceAttributeKernelExecTimeout = 18; ///< Run time limit for kernels executed on the device
|
||||
public static final int hipDeviceAttributeL2CacheSize = 19; ///< Size of L2 cache in bytes. 0 if the device doesn't have L2 cache.
|
||||
public static final int hipDeviceAttributeLocalL1CacheSupported = 20; ///< caching locals in L1 is supported
|
||||
public static final int hipDeviceAttributeLuid = 21; ///< Cuda only. 8-byte locally unique identifier in 8 bytes. Undefined on TCC and non-Windows platforms
|
||||
public static final int hipDeviceAttributeLuidDeviceNodeMask = 22; ///< Cuda only. Luid device node mask. Undefined on TCC and non-Windows platforms
|
||||
public static final int hipDeviceAttributeComputeCapabilityMajor = 23; ///< Major compute capability version number.
|
||||
public static final int hipDeviceAttributeManagedMemory = 24; ///< Device supports allocating managed memory on this system
|
||||
public static final int hipDeviceAttributeMaxBlocksPerMultiProcessor = 25; ///< Cuda only. Max block size per multiprocessor
|
||||
public static final int hipDeviceAttributeMaxBlockDimX = 26; ///< Max block size in width.
|
||||
public static final int hipDeviceAttributeMaxBlockDimY = 27; ///< Max block size in height.
|
||||
public static final int hipDeviceAttributeMaxBlockDimZ = 28; ///< Max block size in depth.
|
||||
public static final int hipDeviceAttributeMaxGridDimX = 29; ///< Max grid size in width.
|
||||
public static final int hipDeviceAttributeMaxGridDimY = 30; ///< Max grid size in height.
|
||||
public static final int hipDeviceAttributeMaxGridDimZ = 31; ///< Max grid size in depth.
|
||||
public static final int hipDeviceAttributeMaxSurface1D = 32; ///< Maximum size of 1D surface.
|
||||
public static final int hipDeviceAttributeMaxSurface1DLayered = 33; ///< Cuda only. Maximum dimensions of 1D layered surface.
|
||||
public static final int hipDeviceAttributeMaxSurface2D = 34; ///< Maximum dimension (width; height) of 2D surface.
|
||||
public static final int hipDeviceAttributeMaxSurface2DLayered = 35; ///< Cuda only. Maximum dimensions of 2D layered surface.
|
||||
public static final int hipDeviceAttributeMaxSurface3D = 36; ///< Maximum dimension (width; height; depth) of 3D surface.
|
||||
public static final int hipDeviceAttributeMaxSurfaceCubemap = 37; ///< Cuda only. Maximum dimensions of Cubemap surface.
|
||||
public static final int hipDeviceAttributeMaxSurfaceCubemapLayered = 38; ///< Cuda only. Maximum dimension of Cubemap layered surface.
|
||||
public static final int hipDeviceAttributeMaxTexture1DWidth = 39; ///< Maximum size of 1D texture.
|
||||
public static final int hipDeviceAttributeMaxTexture1DLayered = 40; ///< Cuda only. Maximum dimensions of 1D layered texture.
|
||||
public static final int hipDeviceAttributeMaxTexture1DLinear = 41; ///< Maximum number of elements allocatable in a 1D linear texture.
|
||||
///< Use cudaDeviceGetTexture1DLinearMaxWidth() instead on Cuda.
|
||||
public static final int hipDeviceAttributeMaxTexture1DMipmap = 42; ///< Cuda only. Maximum size of 1D mipmapped texture.
|
||||
public static final int hipDeviceAttributeMaxTexture2DWidth = 43; ///< Maximum dimension width of 2D texture.
|
||||
public static final int hipDeviceAttributeMaxTexture2DHeight = 44; ///< Maximum dimension hight of 2D texture.
|
||||
public static final int hipDeviceAttributeMaxTexture2DGather = 45; ///< Cuda only. Maximum dimensions of 2D texture if gather operations performed.
|
||||
public static final int hipDeviceAttributeMaxTexture2DLayered = 46; ///< Cuda only. Maximum dimensions of 2D layered texture.
|
||||
public static final int hipDeviceAttributeMaxTexture2DLinear = 47; ///< Cuda only. Maximum dimensions (width; height; pitch) of 2D textures bound to pitched memory.
|
||||
public static final int hipDeviceAttributeMaxTexture2DMipmap = 48; ///< Cuda only. Maximum dimensions of 2D mipmapped texture.
|
||||
public static final int hipDeviceAttributeMaxTexture3DWidth = 49; ///< Maximum dimension width of 3D texture.
|
||||
public static final int hipDeviceAttributeMaxTexture3DHeight = 50; ///< Maximum dimension height of 3D texture.
|
||||
public static final int hipDeviceAttributeMaxTexture3DDepth = 51; ///< Maximum dimension depth of 3D texture.
|
||||
public static final int hipDeviceAttributeMaxTexture3DAlt = 52; ///< Cuda only. Maximum dimensions of alternate 3D texture.
|
||||
public static final int hipDeviceAttributeMaxTextureCubemap = 53; ///< Cuda only. Maximum dimensions of Cubemap texture
|
||||
public static final int hipDeviceAttributeMaxTextureCubemapLayered = 54; ///< Cuda only. Maximum dimensions of Cubemap layered texture.
|
||||
public static final int hipDeviceAttributeMaxThreadsDim = 55; ///< Maximum dimension of a block
|
||||
public static final int hipDeviceAttributeMaxThreadsPerBlock = 56; ///< Maximum number of threads per block.
|
||||
public static final int hipDeviceAttributeMaxThreadsPerMultiProcessor = 57; ///< Maximum resident threads per multiprocessor.
|
||||
public static final int hipDeviceAttributeMaxPitch = 58; ///< Maximum pitch in bytes allowed by memory copies
|
||||
public static final int hipDeviceAttributeMemoryBusWidth = 59; ///< Global memory bus width in bits.
|
||||
public static final int hipDeviceAttributeMemoryClockRate = 60; ///< Peak memory clock frequency in kilohertz.
|
||||
public static final int hipDeviceAttributeComputeCapabilityMinor = 61; ///< Minor compute capability version number.
|
||||
public static final int hipDeviceAttributeMultiGpuBoardGroupID = 62; ///< Cuda only. Unique ID of device group on the same multi-GPU board
|
||||
public static final int hipDeviceAttributeMultiprocessorCount = 63; ///< Number of multiprocessors on the device.
|
||||
public static final int hipDeviceAttributeName = 64; ///< Device name.
|
||||
public static final int hipDeviceAttributePageableMemoryAccess = 65; ///< Device supports coherently accessing pageable memory
|
||||
///< without calling hipHostRegister on it
|
||||
public static final int hipDeviceAttributePageableMemoryAccessUsesHostPageTables = 66; ///< Device accesses pageable memory via the host's page tables
|
||||
public static final int hipDeviceAttributePciBusId = 67; ///< PCI Bus ID. // should be 68 but seems to be one off -- Harlekin
|
||||
public static final int hipDeviceAttributePciDeviceId = 68; ///< PCI Device ID. // see above
|
||||
public static final int hipDeviceAttributePciDomainID = 69; ///< PCI Domain ID. // see above
|
||||
public static final int hipDeviceAttributePersistingL2CacheMaxSize = 70; ///< Cuda11 only. Maximum l2 persisting lines capacity in bytes
|
||||
public static final int hipDeviceAttributeMaxRegistersPerBlock = 71; ///< 32-bit registers available to a thread block. This number is shared
|
||||
///< by all thread blocks simultaneously resident on a multiprocessor.
|
||||
public static final int hipDeviceAttributeMaxRegistersPerMultiprocessor = 72; ///< 32-bit registers available per block.
|
||||
public static final int hipDeviceAttributeReservedSharedMemPerBlock = 73; ///< Cuda11 only. Shared memory reserved by CUDA driver per block.
|
||||
public static final int hipDeviceAttributeMaxSharedMemoryPerBlock = 74; ///< Maximum shared memory available per block in bytes.
|
||||
public static final int hipDeviceAttributeSharedMemPerBlockOptin = 75; ///< Cuda only. Maximum shared memory per block usable by special opt in.
|
||||
public static final int hipDeviceAttributeSharedMemPerMultiprocessor = 76; ///< Cuda only. Shared memory available per multiprocessor.
|
||||
public static final int hipDeviceAttributeSingleToDoublePrecisionPerfRatio = 77; ///< Cuda only. Performance ratio of single precision to double precision.
|
||||
public static final int hipDeviceAttributeStreamPrioritiesSupported = 78; ///< Cuda only. Whether to support stream priorities.
|
||||
public static final int hipDeviceAttributeSurfaceAlignment = 79; ///< Cuda only. Alignment requirement for surfaces
|
||||
public static final int hipDeviceAttributeTccDriver = 80; ///< Cuda only. Whether device is a Tesla device using TCC driver
|
||||
public static final int hipDeviceAttributeTextureAlignment = 81; ///< Alignment requirement for textures
|
||||
public static final int hipDeviceAttributeTexturePitchAlignment = 82; ///< Pitch alignment requirement for 2D texture references bound to pitched memory;
|
||||
public static final int hipDeviceAttributeTotalConstantMemory = 83; ///< Constant memory size in bytes.
|
||||
public static final int hipDeviceAttributeTotalGlobalMem = 84; ///< Global memory available on devicice.
|
||||
public static final int hipDeviceAttributeUnifiedAddressing = 85; ///< Cuda only. An unified address space shared with the host.
|
||||
public static final int hipDeviceAttributeUuid = 86; ///< Cuda only. Unique ID in 16 byte.
|
||||
public static final int hipDeviceAttributeWarpSize = 87; ///< Warp size in threads.
|
||||
public static final int hipDeviceAttributeMemoryPoolsSupported = 88; ///< Device supports HIP Stream Ordered Memory Allocator
|
||||
public static final int hipDeviceAttributeVirtualMemoryManagementSupported = 89; ///< Device supports HIP virtual memory management
|
||||
|
||||
public static final int hipDeviceAttributeCudaCompatibleEnd = 90;
|
||||
public static final int hipDeviceAttributeAmdSpecificBegin = 91;
|
||||
|
||||
public static final int hipDeviceAttributeClockInstructionRate = 92; ///< Frequency in khz of the timer used by the device-side "clock*"
|
||||
public static final int hipDeviceAttributeArch = 93; ///< Device architecture
|
||||
public static final int hipDeviceAttributeMaxSharedMemoryPerMultiprocessor = 94; ///< Maximum Shared Memory PerMultiprocessor.
|
||||
public static final int hipDeviceAttributeGcnArch = 95; ///< Device gcn architecture
|
||||
public static final int hipDeviceAttributeGcnArchName = 96; ///< Device gcnArch name in 256 bytes
|
||||
public static final int hipDeviceAttributeHdpMemFlushCntl = 97; ///< Address of the HDP_MEM_COHERENCY_FLUSH_CNTL register
|
||||
public static final int hipDeviceAttributeHdpRegFlushCntl = 98; ///< Address of the HDP_REG_COHERENCY_FLUSH_CNTL register
|
||||
public static final int hipDeviceAttributeCooperativeMultiDeviceUnmatchedFunc = 99; ///< Supports cooperative launch on multiple
|
||||
///< devices with unmatched functions
|
||||
public static final int hipDeviceAttributeCooperativeMultiDeviceUnmatchedGridDim = 100; ///< Supports cooperative launch on multiple
|
||||
///< devices with unmatched grid dimensions
|
||||
public static final int hipDeviceAttributeCooperativeMultiDeviceUnmatchedBlockDim = 101; ///< Supports cooperative launch on multiple
|
||||
///< devices with unmatched block dimensions
|
||||
public static final int hipDeviceAttributeCooperativeMultiDeviceUnmatchedSharedMem = 102; ///< Supports cooperative launch on multiple
|
||||
///< devices with unmatched shared memories
|
||||
public static final int hipDeviceAttributeIsLargeBar = 103; ///< Whether it is LargeBar
|
||||
public static final int hipDeviceAttributeAsicRevision = 104; ///< Revision of the GPU in this device
|
||||
public static final int hipDeviceAttributeCanUseStreamWaitValue = 105; ///< '1' if Device supports hipStreamWaitValue32() and
|
||||
///< hipStreamWaitValue64(); '0' otherwise.
|
||||
public static final int hipDeviceAttributeImageSupport = 106; ///< '1' if Device supports image; '0' otherwise.
|
||||
public static final int hipDeviceAttributePhysicalMultiProcessorCount = 107; ///< All available physical compute
|
||||
///< units for the device
|
||||
public static final int hipDeviceAttributeFineGrainSupport = 108; ///< '1' if Device supports fine grain; '0' otherwise
|
||||
|
||||
public static final int hipDeviceAttributeAmdSpecificEnd = 109;
|
||||
public static final int hipDeviceAttributeVendorSpecificBegin = 110;
|
||||
// Extended attributes for vendors
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package com.sheepit.client.hardware.gpu.hip.data;
|
||||
|
||||
import com.sun.jna.Structure;
|
||||
|
||||
@Structure.FieldOrder({
|
||||
"name",
|
||||
"totalGlobalMem",
|
||||
"major",
|
||||
"minor",
|
||||
"multiProcessCount",
|
||||
"l2CacheSize",
|
||||
"maxThreadsPerMultiProcessor",
|
||||
"computeMode",
|
||||
"clockInstructionRate",
|
||||
// "arch",
|
||||
"concurrentKernels",
|
||||
"pciBusID",
|
||||
"pciDeviceID",
|
||||
"maxSharedMemoryPerMultiProcessor",
|
||||
"isMultiGpuBoard",
|
||||
"canMapHostMemory",
|
||||
"gcnArch",
|
||||
"gcnArchName"
|
||||
})
|
||||
public class HIPDeviceProp_t extends Structure {
|
||||
public static class ByReference extends HIPDeviceProp_t implements Structure.ByReference {
|
||||
|
||||
}
|
||||
public byte[] name;
|
||||
public long totalGlobalMem;
|
||||
public int major;
|
||||
public int minor;
|
||||
public int multiProcessCount;
|
||||
public int l2CacheSize;
|
||||
public int maxThreadsPerMultiProcessor;
|
||||
public int computeMode;
|
||||
public int clockInstructionRate;
|
||||
//public HIPDeviceArch_t arch;
|
||||
public int concurrentKernels;
|
||||
public int pciBusID;
|
||||
public int pciDeviceID;
|
||||
public long maxSharedMemoryPerMultiProcessor;
|
||||
public boolean isMultiGpuBoard;
|
||||
public boolean canMapHostMemory;
|
||||
public int gcnArch;
|
||||
public char[] gcnArchName;
|
||||
|
||||
|
||||
public HIPDeviceProp_t() {
|
||||
// this.arch = new HIPDeviceArch_t();
|
||||
name = new byte[256];
|
||||
gcnArchName = new char[256];
|
||||
this.totalGlobalMem = 0L;
|
||||
this.major = 0;
|
||||
this.minor = 0;
|
||||
this.multiProcessCount = 0;
|
||||
this.l2CacheSize = 0;
|
||||
this.maxThreadsPerMultiProcessor = 0;
|
||||
this.computeMode = 0;
|
||||
this.clockInstructionRate = 0;
|
||||
this.concurrentKernels = 0;
|
||||
this.pciBusID = 0;
|
||||
this.pciDeviceID = 0;
|
||||
this.maxSharedMemoryPerMultiProcessor = 0L;
|
||||
this.isMultiGpuBoard = false;
|
||||
this.canMapHostMemory = false;
|
||||
this.gcnArch = 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.sheepit.client.hardware.gpu.hip.data;
|
||||
|
||||
public class HipError_t {
|
||||
public static final int HIP_SUCCESS = 0;
|
||||
public static final int HIP_ERROR_INVALID_VALUE = 1;
|
||||
public static final int HIP_ERROR_MEMORY_ALLOCATION = 2;
|
||||
public static final int HIP_ERROR_NOT_INITIALIZED = 3;
|
||||
public static final int HIP_ERROR_INITIALIZATION_ERROR = 3; //Deprecated
|
||||
public static final int HIP_ERROR_DEINITIALIZED = 4;
|
||||
public static final int HIP_ERROR_PROFILER_DISABLED = 5;
|
||||
public static final int HIP_ERROR_PROIFLER_NOT_INITIALIZED = 6;
|
||||
public static final int HIP_ERROR_PROFILER_ALREADY_STARTED = 7;
|
||||
public static final int HIP_ERROR_PROFILER_ALREADY_STOPPED = 8;
|
||||
public static final int HIP_ERROR_INVALID_CONFIGURATION = 9;
|
||||
public static final int HIP_ERROR_INVALID_PITCH_VALUE = 12;
|
||||
public static final int HIP_ERROR_INVALID_SYMBOL = 13;
|
||||
public static final int HIP_ERROR_INVALID_DEVICE_POINTER = 17;
|
||||
public static final int HIP_ERROR_INVALID_MEMCPY_DIRECTION = 21;
|
||||
public static final int HIP_ERROR_INSUFFICIENT_DRIVER = 35;
|
||||
public static final int HIP_ERROR_MISSING_CONFIGURATION = 52;
|
||||
public static final int HIP_ERROR_PRIOR_LAUNCH_FAILURE = 53;
|
||||
public static final int HIP_ERROR_INVALID_DEVICE_FUNCTION = 98;
|
||||
public static final int HIP_ERROR_NO_DEVICE = 100;
|
||||
public static final int HIP_ERROR_INVALID_DEVICE = 101;
|
||||
public static final int HIP_ERROR_INVALID_IMAGE = 200;
|
||||
}
|
||||
@@ -1,175 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2013-2014 Laurent CLOUET
|
||||
* Author Laurent CLOUET <laurent.clouet@nopnop.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; version 2
|
||||
* of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
package com.sheepit.client.hardware.gpu.opencl;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.sheepit.client.hardware.gpu.GPUDevice;
|
||||
import com.sheepit.client.hardware.gpu.GPULister;
|
||||
import com.sheepit.client.hardware.gpu.opencl.OpenCLLib.CLDeviceId;
|
||||
import com.sheepit.client.hardware.gpu.opencl.OpenCLLib.CLPlatformId;
|
||||
import com.sun.jna.Native;
|
||||
import com.sun.jna.ptr.IntByReference;
|
||||
|
||||
public class OpenCL implements GPULister {
|
||||
public static String TYPE = "OPENCL";
|
||||
|
||||
@Override public List<GPUDevice> getGpus() {
|
||||
OpenCLLib lib = null;
|
||||
|
||||
String path = "OpenCL";
|
||||
try {
|
||||
lib = (OpenCLLib) Native.load(path, OpenCLLib.class);
|
||||
}
|
||||
catch (java.lang.UnsatisfiedLinkError e) {
|
||||
System.out.println("OpenCL::getGpus failed(A) to load OpenCL lib (path: " + path + ")");
|
||||
return null;
|
||||
}
|
||||
catch (java.lang.ExceptionInInitializerError e) {
|
||||
System.out.println("OpenCL::getGpus failed(B) ExceptionInInitializerError " + e);
|
||||
return null;
|
||||
}
|
||||
catch (Exception e) {
|
||||
System.out.println("OpenCL::getGpus failed(C) generic exception " + e);
|
||||
return null;
|
||||
}
|
||||
|
||||
int status = -1;
|
||||
|
||||
// get the number of platform
|
||||
IntByReference number_platforms = new IntByReference();
|
||||
|
||||
status = lib.clGetPlatformIDs(0, null, number_platforms);
|
||||
if (status != OpenCLLib.CL_SUCCESS) {
|
||||
System.out.println("OpenCL::getGpus failed(D) status: " + status);
|
||||
return null;
|
||||
}
|
||||
|
||||
// now we can create the platforms
|
||||
|
||||
final OpenCLLib.CLPlatformId.ByReference e6ref = new OpenCLLib.CLPlatformId.ByReference();
|
||||
OpenCLLib.CLPlatformId.ByReference[] plateforms = (OpenCLLib.CLPlatformId.ByReference[]) e6ref.toArray(number_platforms.getValue());
|
||||
|
||||
status = lib.clGetPlatformIDs(number_platforms.getValue(), plateforms, null);
|
||||
if (status != OpenCLLib.CL_SUCCESS) {
|
||||
System.out.println("OpenCL::getGpus failed(E) status: " + status);
|
||||
return null;
|
||||
}
|
||||
|
||||
List<GPUDevice> available_devices = new ArrayList<GPUDevice>(1);
|
||||
// Devices are numbered consecutively across platforms.
|
||||
int id = 0;
|
||||
for (int i = 0; i < number_platforms.getValue(); i++) {
|
||||
// get number of devices in platform
|
||||
IntByReference device_count = new IntByReference();
|
||||
|
||||
status = lib.clGetDeviceIDs(plateforms[i], OpenCLLib.CL_DEVICE_TYPE_GPU, 0, null, device_count);
|
||||
if (status == OpenCLLib.CL_DEVICE_NOT_FOUND) {
|
||||
System.out.println("OpenCL::getGpus no device found on plateforms[" + i + "]");
|
||||
continue;
|
||||
}
|
||||
if (status != OpenCLLib.CL_SUCCESS) {
|
||||
System.out.println("OpenCL::getGpus failed(F) status: " + status);
|
||||
return null;
|
||||
}
|
||||
|
||||
final OpenCLLib.CLDeviceId.ByReference e6ref4 = new OpenCLLib.CLDeviceId.ByReference();
|
||||
|
||||
OpenCLLib.CLDeviceId.ByReference[] devices = (OpenCLLib.CLDeviceId.ByReference[]) e6ref4.toArray(device_count.getValue());
|
||||
|
||||
status = lib.clGetDeviceIDs(plateforms[i], OpenCLLib.CL_DEVICE_TYPE_GPU, device_count.getValue(), devices, null);
|
||||
if (status != OpenCLLib.CL_SUCCESS) {
|
||||
System.out.println("OpenCL::getGpus failed(G) status: " + status);
|
||||
return null;
|
||||
}
|
||||
|
||||
for (int j = 0; j < device_count.getValue(); j++) {
|
||||
String name = getInfodeviceString(lib, devices[j], OpenCLLib.CL_DEVICE_BOARD_NAME_AMD);
|
||||
String platform_name = getInfoPlatform(lib, plateforms[i], OpenCLLib.CL_PLATFORM_NAME);
|
||||
long vram = getInfodeviceLong(lib, devices[j], OpenCLLib.CL_DEVICE_GLOBAL_MEM_SIZE);
|
||||
if (name != null && vram > 0) {
|
||||
if (name.equals("Radeon RX Vega")) {
|
||||
name += " " + getInfodeviceLong(lib, devices[j], OpenCLLib.CL_DEVICE_MAX_COMPUTE_UNITS);
|
||||
}
|
||||
GPUDevice gpu = new GPUDevice(TYPE, name, vram, getBlenderId(lib, devices[j], platform_name, name));
|
||||
gpu.setOldId(TYPE + "_" + id);
|
||||
available_devices.add(gpu);
|
||||
}
|
||||
id++;
|
||||
}
|
||||
}
|
||||
|
||||
return available_devices;
|
||||
}
|
||||
|
||||
private static String getInfodeviceString(OpenCLLib lib, CLDeviceId.ByReference device, int type) {
|
||||
byte name[] = new byte[256];
|
||||
|
||||
int status = lib.clGetDeviceInfo(device, type, 256, name, null);
|
||||
if (status != OpenCLLib.CL_SUCCESS) {
|
||||
System.out.println("OpenCL::getInfodeviceString failed(H) status: " + status + " type: " + type);
|
||||
return null;
|
||||
}
|
||||
|
||||
return new String(name).trim();
|
||||
}
|
||||
|
||||
private static long getInfodeviceLong(OpenCLLib lib, CLDeviceId.ByReference device, int type) {
|
||||
byte name[] = new byte[256];
|
||||
|
||||
int status = lib.clGetDeviceInfo(device, type, 256, name, null);
|
||||
if (status != OpenCLLib.CL_SUCCESS) {
|
||||
System.out.println("OpenCL::getInfodeviceLong failed(I) status: " + status + " type: " + type);
|
||||
return -1;
|
||||
}
|
||||
|
||||
ByteBuffer wrapped = ByteBuffer.wrap(name);
|
||||
wrapped.order(ByteOrder.LITTLE_ENDIAN);
|
||||
|
||||
return wrapped.getLong();
|
||||
}
|
||||
|
||||
private static String getInfoPlatform(OpenCLLib lib, CLPlatformId.ByReference platform, int type) {
|
||||
byte name[] = new byte[256];
|
||||
|
||||
int status = lib.clGetPlatformInfo(platform, type, 256, name, null);
|
||||
if (status != OpenCLLib.CL_SUCCESS) {
|
||||
System.out.println("GPU::getInfoPlatform failed(J) status: " + status + " type: " + type);
|
||||
return null;
|
||||
}
|
||||
|
||||
return new String(name).trim();
|
||||
}
|
||||
|
||||
private static String getBlenderId(OpenCLLib lib, CLDeviceId.ByReference device, String platform, String name) {
|
||||
byte topology[] = new byte[24];
|
||||
|
||||
int status = lib.clGetDeviceInfo(device, lib.CL_DEVICE_TOPOLOGY_AMD, 24, topology, null);
|
||||
if (status != OpenCLLib.CL_SUCCESS) {
|
||||
System.out.println("OpenCL::getBlenderId failed(I) status: " + status);
|
||||
return "";
|
||||
}
|
||||
|
||||
return String.format("%s_%s_%s_%02x:%02x.%01x", TYPE, platform, name, topology[21], topology[22], topology[23]);
|
||||
}
|
||||
}
|
||||
@@ -1,84 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2013-2014 Laurent CLOUET
|
||||
* Author Laurent CLOUET <laurent.clouet@nopnop.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; version 2
|
||||
* of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
package com.sheepit.client.hardware.gpu.opencl;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.sun.jna.Library;
|
||||
import com.sun.jna.Structure;
|
||||
import com.sun.jna.ptr.IntByReference;
|
||||
|
||||
public interface OpenCLLib extends Library {
|
||||
// status
|
||||
public static final int CL_SUCCESS = 0;
|
||||
public static final int CL_DEVICE_NOT_FOUND = -1;
|
||||
|
||||
public static final int CL_PLATFORM_VENDOR = 0x0903;
|
||||
public static final int CL_PLATFORM_NAME = 0x0902;
|
||||
|
||||
// cl_device_type
|
||||
public static final int CL_DEVICE_TYPE_DEFAULT = (1 << 0);
|
||||
public static final int CL_DEVICE_TYPE_CPU = (1 << 1);
|
||||
public static final int CL_DEVICE_TYPE_GPU = (1 << 2);
|
||||
public static final int CL_DEVICE_TYPE_ACCELERATOR = (1 << 3);
|
||||
public static final int CL_DEVICE_TYPE_CUSTOM = (1 << 4);
|
||||
public static final int CL_DEVICE_TYPE_ALL = 0xFFFFFFFF;
|
||||
|
||||
// cl_device_info
|
||||
public static final int CL_DEVICE_NAME = 0x102B;
|
||||
public static final int CL_DEVICE_VENDOR = 0x102C;
|
||||
public static final int CL_DEVICE_VERSION = 0x102D;
|
||||
public static final int CL_DEVICE_MAX_COMPUTE_UNITS = 0x1002;
|
||||
public static final int CL_DEVICE_GLOBAL_MEM_SIZE = 0x101F;
|
||||
public static final int CL_DEVICE_BOARD_NAME_AMD = 0x4038;
|
||||
public static final int CL_DEVICE_TOPOLOGY_AMD = 0x4037;
|
||||
|
||||
public int clGetPlatformIDs(int num_entries, CLPlatformId.ByReference[] platforms, IntByReference num_platforms);
|
||||
|
||||
public int clGetPlatformInfo(CLPlatformId.ByReference platform, int param_name, long param_value_size, byte[] destination, long size_ret[]);
|
||||
|
||||
public int clGetDeviceIDs(CLPlatformId.ByReference platform, int param_name, int num_entries, CLDeviceId.ByReference[] devices,
|
||||
IntByReference device_count);
|
||||
|
||||
public int clGetDeviceInfo(CLDeviceId.ByReference device, int param_name, long param_value_size, byte[] destination, long size_ret[]);
|
||||
|
||||
public static class CLPlatformId extends Structure {
|
||||
public static class ByReference extends CLPlatformId implements Structure.ByReference {
|
||||
}
|
||||
|
||||
public int id;
|
||||
|
||||
@Override protected List<String> getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "id" });
|
||||
}
|
||||
}
|
||||
|
||||
public static class CLDeviceId extends Structure {
|
||||
public static class ByReference extends CLDeviceId implements Structure.ByReference {
|
||||
}
|
||||
|
||||
public int id;
|
||||
|
||||
@Override protected List<String> getFieldOrder() {
|
||||
return Arrays.asList(new String[] { "id" });
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
package com.sheepit.client.standalone;
|
||||
|
||||
import com.sheepit.client.hardware.gpu.hip.HIP;
|
||||
import org.kohsuke.args4j.CmdLineException;
|
||||
import org.kohsuke.args4j.CmdLineParser;
|
||||
import org.kohsuke.args4j.Option;
|
||||
@@ -51,7 +52,6 @@ import com.sheepit.client.Utils;
|
||||
import com.sheepit.client.hardware.gpu.GPU;
|
||||
import com.sheepit.client.hardware.gpu.GPUDevice;
|
||||
import com.sheepit.client.hardware.gpu.nvidia.Nvidia;
|
||||
import com.sheepit.client.hardware.gpu.opencl.OpenCL;
|
||||
import com.sheepit.client.network.Proxy;
|
||||
import com.sheepit.client.os.OS;
|
||||
|
||||
@@ -194,8 +194,8 @@ public class Worker {
|
||||
config.setHeadless(headless);
|
||||
|
||||
if (gpu_device != null) {
|
||||
if (gpu_device.startsWith(Nvidia.TYPE) == false && gpu_device.startsWith(OpenCL.TYPE) == false) {
|
||||
System.err.println("ERROR: The entered GPU_ID is invalid. The GPU_ID should look like '" + Nvidia.TYPE + "_#' or '" + OpenCL.TYPE
|
||||
if (gpu_device.startsWith(Nvidia.TYPE) == false && gpu_device.startsWith(HIP.TYPE) == false) {
|
||||
System.err.println("ERROR: The entered GPU_ID is invalid. The GPU_ID should look like '" + Nvidia.TYPE + "_#' or '" + HIP.TYPE
|
||||
+ "_#'. Please use the proper GPU_ID from the GPU list below\n");
|
||||
showGPUList(parser);
|
||||
}
|
||||
|
||||
@@ -63,8 +63,8 @@ import com.sheepit.client.hardware.cpu.CPU;
|
||||
import com.sheepit.client.hardware.gpu.GPU;
|
||||
import com.sheepit.client.hardware.gpu.GPUDevice;
|
||||
import com.sheepit.client.hardware.gpu.GPULister;
|
||||
import com.sheepit.client.hardware.gpu.hip.HIP;
|
||||
import com.sheepit.client.hardware.gpu.nvidia.Nvidia;
|
||||
import com.sheepit.client.hardware.gpu.opencl.OpenCL;
|
||||
import com.sheepit.client.network.Proxy;
|
||||
import com.sheepit.client.os.OS;
|
||||
import com.sheepit.client.standalone.GuiSwing;
|
||||
@@ -293,11 +293,11 @@ public class Settings implements Activity {
|
||||
if ((config.getComputeMethod() == ComputeType.GPU || config.getComputeMethod() == ComputeType.CPU_GPU) && config.getGPUDevice() != null) {
|
||||
GPULister gpu;
|
||||
|
||||
if (config.getGPUDevice().getType().equals("CUDA")) {
|
||||
if (config.getGPUDevice().getType().equals(Nvidia.TYPE)) {
|
||||
gpu = new Nvidia();
|
||||
}
|
||||
else if (config.getGPUDevice().getType().equals("OPENCL")) {
|
||||
gpu = new OpenCL();
|
||||
else if (config.getGPUDevice().getType().equals(HIP.TYPE)) {
|
||||
gpu = new HIP();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -606,11 +606,11 @@ public class Settings implements Activity {
|
||||
}
|
||||
else {
|
||||
GPULister gpu;
|
||||
if (useGPUs.get(counter).getGPUDevice().getType().equals("CUDA")) {
|
||||
if (useGPUs.get(counter).getGPUDevice().getType().equals(Nvidia.TYPE)) {
|
||||
gpu = new Nvidia();
|
||||
}
|
||||
else if (useGPUs.get(counter).getGPUDevice().getType().equals("OPENCL")) {
|
||||
gpu = new OpenCL();
|
||||
else if (useGPUs.get(counter).getGPUDevice().getType().equals(HIP.TYPE)) {
|
||||
gpu = new HIP();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user