Merge branch 'change/remove_hip_support' into 'master'
removed HIP support See merge request sheepitrenderfarm/client!197
This commit is contained in:
@@ -38,15 +38,6 @@ public class GPU {
|
|||||||
devices.addAll(gpus);
|
devices.addAll(gpus);
|
||||||
}
|
}
|
||||||
|
|
||||||
OS os = OS.getOS();
|
|
||||||
if (os instanceof Windows) { // for now we only allow AMD on Windows
|
|
||||||
|
|
||||||
gpus = new HIP().getGpus();
|
|
||||||
if (gpus != null) {
|
|
||||||
devices.addAll(gpus);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,6 +66,16 @@ public class GPU {
|
|||||||
return devices;
|
return devices;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean hasHIPDevices() {
|
||||||
|
OS os = OS.getOS();
|
||||||
|
if (os instanceof Windows) { // for now we only allow AMD on Windows
|
||||||
|
return HIP.hasHIPDevices();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static GPUDevice getGPUDevice(String deviceId) {
|
public static GPUDevice getGPUDevice(String deviceId) {
|
||||||
if (deviceId == null) {
|
if (deviceId == null) {
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -1,97 +1,22 @@
|
|||||||
package com.sheepit.client.hardware.gpu.hip;
|
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.hardware.gpu.hip.data.HipError_t;
|
||||||
|
import com.sheepit.client.os.OS;
|
||||||
import com.sheepit.client.os.Windows;
|
import com.sheepit.client.os.Windows;
|
||||||
import com.sun.jna.Native;
|
import com.sun.jna.Native;
|
||||||
import com.sun.jna.ptr.IntByReference;
|
import com.sun.jna.ptr.IntByReference;
|
||||||
import oshi.SystemInfo;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
public class HIP {
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class HIP implements GPULister {
|
|
||||||
|
|
||||||
private static final String HIP_LIBRARY = "amdhip64";
|
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";
|
public static final String TYPE = "HIP";
|
||||||
|
|
||||||
private HIPLib hip;
|
private static int HIP_DEVICES_CACHED = -1; //Store number of retrieved devices to save sys calls
|
||||||
|
|
||||||
public HIP() {
|
|
||||||
|
|
||||||
}
|
private static int getNumberOfDevices(HIPLib hipLib) {
|
||||||
|
|
||||||
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 ") || gpu.getName().contains("Radeon ")) {
|
|
||||||
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();
|
IntByReference deviceCount = new IntByReference();
|
||||||
int status = hip.hipGetDeviceCount(deviceCount);
|
int status = hipLib.hipGetDeviceCount(deviceCount);
|
||||||
if (status != HipError_t.HIP_SUCCESS) {
|
if (status != HipError_t.HIP_SUCCESS) {
|
||||||
System.err.println("Error");
|
System.err.println("Error");
|
||||||
return -1;
|
return -1;
|
||||||
@@ -99,119 +24,38 @@ public class HIP implements GPULister {
|
|||||||
return deviceCount.getValue();
|
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<>();
|
|
||||||
|
public static boolean hasHIPDevices() {
|
||||||
int numberOfDevices = getNumberOfDevices();
|
|
||||||
if (numberOfDevices < 1) {
|
if (HIP_DEVICES_CACHED >= 0) {
|
||||||
return null;
|
return HIP_DEVICES_CACHED > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//check that the driver is capable
|
OS os = OS.getOS();
|
||||||
String driverVersion = "";
|
if (os instanceof Windows) {
|
||||||
try {
|
|
||||||
driverVersion = getDriverVersion();
|
try {
|
||||||
if (driverVersion == null) {
|
HIPLib hip = (HIPLib) Native.load(HIP_LIBRARY, HIPLib.class);
|
||||||
return null;
|
HIP_DEVICES_CACHED = getNumberOfDevices(hip);
|
||||||
}
|
}
|
||||||
|
catch (java.lang.UnsatisfiedLinkError e) {
|
||||||
boolean driverTooOld = GPUDevice.compareVersions(driverVersion, MINIMAL_WINDOWS_DRIVER_VERSION) < 0;
|
System.out.println("HIP::getGpus failed(A) to load HIP lib (path: " + HIP_LIBRARY + ")");
|
||||||
|
}
|
||||||
if (driverTooOld) {
|
catch (java.lang.ExceptionInInitializerError e) {
|
||||||
System.out.println("HIP::getGpus AMD driver too old");
|
System.out.println("HIP::getGpus failed(B) ExceptionInInitializerError " + e);
|
||||||
System.out.println("Driver version: " + driverVersion);
|
}
|
||||||
return null;
|
catch (Exception e) {
|
||||||
|
System.out.println("HIP::getGpus failed(C) generic exception " + e);
|
||||||
|
}
|
||||||
|
if (HIP_DEVICES_CACHED < 0) {
|
||||||
|
HIP_DEVICES_CACHED = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (NumberFormatException e) {
|
else {
|
||||||
System.out.println("HIP::getGpus Unable to convert driver version to long: " + driverVersion + ". Exception: " + e.getMessage());
|
HIP_DEVICES_CACHED = 0;
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int numberedID = 0;
|
return HIP_DEVICES_CACHED > 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);
|
|
||||||
device.setDriverVersion(driverVersion);
|
|
||||||
gpuDevices.add(device);
|
|
||||||
numberedID++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return gpuDevices;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,21 +1,9 @@
|
|||||||
package com.sheepit.client.hardware.gpu.hip;
|
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.Library;
|
||||||
import com.sun.jna.ptr.IntByReference;
|
import com.sun.jna.ptr.IntByReference;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public interface HIPLib extends Library {
|
public interface HIPLib extends Library {
|
||||||
|
|
||||||
int hipGetDeviceCount(IntByReference numDevices);
|
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,132 +0,0 @@
|
|||||||
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
|
|
||||||
}
|
|
||||||
@@ -1,69 +0,0 @@
|
|||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -19,8 +19,9 @@
|
|||||||
|
|
||||||
package com.sheepit.client.standalone;
|
package com.sheepit.client.standalone;
|
||||||
|
|
||||||
import java.util.List;
|
import com.sheepit.client.Configuration;
|
||||||
|
import com.sheepit.client.hardware.gpu.GPU;
|
||||||
|
import com.sheepit.client.hardware.gpu.GPUDevice;
|
||||||
import org.kohsuke.args4j.CmdLineException;
|
import org.kohsuke.args4j.CmdLineException;
|
||||||
import org.kohsuke.args4j.CmdLineParser;
|
import org.kohsuke.args4j.CmdLineParser;
|
||||||
import org.kohsuke.args4j.OptionDef;
|
import org.kohsuke.args4j.OptionDef;
|
||||||
@@ -28,9 +29,7 @@ import org.kohsuke.args4j.spi.OptionHandler;
|
|||||||
import org.kohsuke.args4j.spi.Parameters;
|
import org.kohsuke.args4j.spi.Parameters;
|
||||||
import org.kohsuke.args4j.spi.Setter;
|
import org.kohsuke.args4j.spi.Setter;
|
||||||
|
|
||||||
import com.sheepit.client.Configuration;
|
import java.util.List;
|
||||||
import com.sheepit.client.hardware.gpu.GPU;
|
|
||||||
import com.sheepit.client.hardware.gpu.GPUDevice;
|
|
||||||
|
|
||||||
public class ListGpuParameterHandler<T> extends OptionHandler<T> {
|
public class ListGpuParameterHandler<T> extends OptionHandler<T> {
|
||||||
public ListGpuParameterHandler(CmdLineParser parser, OptionDef option, Setter<? super T> setter) {
|
public ListGpuParameterHandler(CmdLineParser parser, OptionDef option, Setter<? super T> setter) {
|
||||||
@@ -49,6 +48,10 @@ public class ListGpuParameterHandler<T> extends OptionHandler<T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (GPU.hasHIPDevices()) {
|
||||||
|
System.out.println("HIP devices are not supported");
|
||||||
|
}
|
||||||
|
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -194,9 +194,12 @@ public class Worker {
|
|||||||
config.setHeadless(headless);
|
config.setHeadless(headless);
|
||||||
|
|
||||||
if (gpu_device != null) {
|
if (gpu_device != null) {
|
||||||
if (gpu_device.startsWith(Nvidia.TYPE) == false && gpu_device.startsWith(HIP.TYPE) == false) {
|
//catch all the outdated configs
|
||||||
System.err.println("ERROR: The entered GPU_ID is invalid. The GPU_ID should look like '" + Nvidia.TYPE + "_#' or '" + HIP.TYPE
|
if (gpu_device.startsWith(HIP.TYPE)) {
|
||||||
+ "_#'. Please use the proper GPU_ID from the GPU list below\n");
|
System.err.println("ERROR: HIP devices are not supported");
|
||||||
|
}
|
||||||
|
else if (gpu_device.startsWith(Nvidia.TYPE) == false) {
|
||||||
|
System.err.println("ERROR: The entered GPU_ID is invalid. The GPU_ID should look like '" + Nvidia.TYPE + "_#. Please use the proper GPU_ID from the GPU list below\n");
|
||||||
showGPUList(parser);
|
showGPUList(parser);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -271,7 +271,7 @@ public class Settings implements Activity {
|
|||||||
gridbag.setConstraints(useCPU, compute_devices_constraints);
|
gridbag.setConstraints(useCPU, compute_devices_constraints);
|
||||||
compute_devices_panel.add(useCPU);
|
compute_devices_panel.add(useCPU);
|
||||||
|
|
||||||
if (gpus.size() > 0) {
|
if (gpus.size() > 0 || GPU.hasHIPDevices()) {
|
||||||
for (GPUDevice gpu : gpus) {
|
for (GPUDevice gpu : gpus) {
|
||||||
JCheckBoxGPU gpuCheckBox = new JCheckBoxGPU(gpu);
|
JCheckBoxGPU gpuCheckBox = new JCheckBoxGPU(gpu);
|
||||||
gpuCheckBox.setToolTipText(gpu.getId());
|
gpuCheckBox.setToolTipText(gpu.getId());
|
||||||
@@ -289,17 +289,15 @@ public class Settings implements Activity {
|
|||||||
useGPUs.add(gpuCheckBox);
|
useGPUs.add(gpuCheckBox);
|
||||||
}
|
}
|
||||||
|
|
||||||
//When replacing gpus it can happen that the client can't find the one specified in the config anymore in which case config.getGPUDevice()
|
if (GPU.hasHIPDevices()) {
|
||||||
//returns null
|
JCheckBox gpuCheckBox = new JCheckBox("Unsupported HIP device(s)");
|
||||||
if ((config.getComputeMethod() == ComputeType.GPU || config.getComputeMethod() == ComputeType.CPU_GPU) && config.getGPUDevice() != null) {
|
gpuCheckBox.setToolTipText("SheepIt does not support AMD GPUs due to a lack of use");
|
||||||
GPULister gpu;
|
gpuCheckBox.setEnabled(false);
|
||||||
|
gpuCheckBox.setSelected(false);
|
||||||
|
compute_devices_constraints.gridy++;
|
||||||
|
|
||||||
if (config.getGPUDevice().getType().equals(Nvidia.TYPE)) {
|
gridbag.setConstraints(gpuCheckBox, compute_devices_constraints);
|
||||||
gpu = new Nvidia();
|
compute_devices_panel.add(gpuCheckBox);
|
||||||
}
|
|
||||||
else if (config.getGPUDevice().getType().equals(HIP.TYPE)) {
|
|
||||||
gpu = new HIP();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
compute_devices_constraints.gridx = 1;
|
compute_devices_constraints.gridx = 1;
|
||||||
@@ -308,6 +306,7 @@ public class Settings implements Activity {
|
|||||||
compute_devices_panel.add(new JLabel(" "), compute_devices_constraints); // Add a space between lines
|
compute_devices_panel.add(new JLabel(" "), compute_devices_constraints); // Add a space between lines
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
CPU cpu = new CPU();
|
CPU cpu = new CPU();
|
||||||
if (cpu.cores() > 1) { // if only one core is available, no need to show the choice
|
if (cpu.cores() > 1) { // if only one core is available, no need to show the choice
|
||||||
double step = 1;
|
double step = 1;
|
||||||
@@ -634,9 +633,6 @@ public class Settings implements Activity {
|
|||||||
if (useGPUs.get(counter).getGPUDevice().getType().equals(Nvidia.TYPE)) {
|
if (useGPUs.get(counter).getGPUDevice().getType().equals(Nvidia.TYPE)) {
|
||||||
gpu = new Nvidia();
|
gpu = new Nvidia();
|
||||||
}
|
}
|
||||||
else if (useGPUs.get(counter).getGPUDevice().getType().equals(HIP.TYPE)) {
|
|
||||||
gpu = new HIP();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Simulate a radio button behavior with check buttons while only 1 GPU
|
// Simulate a radio button behavior with check buttons while only 1 GPU
|
||||||
|
|||||||
Reference in New Issue
Block a user