Code formator (#236)

* Re-import code formator
This commit is contained in:
Laurent Clouet
2020-05-28 13:28:42 +02:00
committed by GitHub
parent 1dc865a979
commit 44cf85739c
67 changed files with 697 additions and 955 deletions

View File

@@ -2,7 +2,7 @@
* Copyright (C) 2010-2014 Laurent CLOUET
* Author Laurent CLOUET <laurent.clouet@nopnop.net>
*
* This program is free software; you can redistribute it and/or
* 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.

View File

@@ -2,7 +2,7 @@
* Copyright (C) 2013-2014 Laurent CLOUET
* Author Laurent CLOUET <laurent.clouet@nopnop.net>
*
* This program is free software; you can redistribute it and/or
* 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.

View File

@@ -2,7 +2,7 @@
* Copyright (C) 2013-2014 Laurent CLOUET
* Author Laurent CLOUET <laurent.clouet@nopnop.net>
*
* This program is free software; you can redistribute it and/or
* 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.
@@ -48,7 +48,7 @@ public class GPUDevice {
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
@@ -120,8 +120,7 @@ public class GPUDevice {
this.renderBucketSize = renderBucketSize;
}
@Override
public String toString() {
@Override public String toString() {
return "GPUDevice [type=" + type + ", model='" + model + "', memory=" + memory + ", id=" + id + ", renderbucketSize=" + renderBucketSize + "]";
}
}

View File

@@ -2,7 +2,7 @@
* Copyright (C) 2013-2014 Laurent CLOUET
* Author Laurent CLOUET <laurent.clouet@nopnop.net>
*
* This program is free software; you can redistribute it and/or
* 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.
@@ -27,17 +27,18 @@ public interface CUDA extends Library {
public int cuInit(int flags);
/*
* @return: CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED, CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_VALUE
*/
* @return: CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED, CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_VALUE
*/
public int cuDeviceGetCount(IntByReference count);
public int cuDeviceGetName(byte[] name, int len, int dev);
public int cuDeviceGet (IntByReference device, int ordinal);
public int cuDeviceGet(IntByReference device, int ordinal);
public int cuDeviceGetAttribute (IntByReference pi, int attrib, int dev );
public int cuDeviceGetAttribute(IntByReference pi, int attrib, int dev);
public int cuDeviceTotalMem_v2(LongByReference bytes, int dev);
public int cuDeviceTotalMem(LongByReference bytes, int dev);
}

View File

@@ -2,7 +2,7 @@
* Copyright (C) 2018 Laurent CLOUET
* Author Laurent CLOUET <laurent.clouet@nopnop.net>
*
* This program is free software; you can redistribute it and/or
* 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.
@@ -28,12 +28,12 @@ public class CUDeviceAttribute {
* PCI bus ID of the device
*/
public static final int CU_DEVICE_ATTRIBUTE_PCI_BUS_ID = 33;
/**
* PCI device ID of the device
*/
public static final int CU_DEVICE_ATTRIBUTE_PCI_DEVICE_ID = 34;
/**
* PCI domain ID of the device
*/

View File

@@ -66,18 +66,18 @@ public class CUresult {
/**
* This indicates profiling APIs are called while application is running
* in visual profiler mode.
* in visual profiler mode.
*/
public static final int CUDA_ERROR_PROFILER_DISABLED = 5;
/**
* This indicates profiling has not been initialized for this context.
* Call cuProfilerInitialize() to resolve this.
* This indicates profiling has not been initialized for this context.
* Call cuProfilerInitialize() to resolve this.
*
* @deprecated This error return is deprecated as of CUDA 5.0.
* It is no longer an error to attempt to enable/disable the
* profiling via ::cuProfilerStart or ::cuProfilerStop without
* initialization.
* @deprecated This error return is deprecated as of CUDA 5.0.
* It is no longer an error to attempt to enable/disable the
* profiling via ::cuProfilerStart or ::cuProfilerStop without
* initialization.
*/
public static final int CUDA_ERROR_PROFILER_NOT_INITIALIZED = 6;
@@ -85,8 +85,8 @@ public class CUresult {
* This indicates profiler has already been started and probably
* cuProfilerStart() is incorrectly called.
*
* @deprecated This error return is deprecated as of CUDA 5.0.
* It is no longer an error to call cuProfilerStart() when
* @deprecated This error return is deprecated as of CUDA 5.0.
* It is no longer an error to call cuProfilerStart() when
* profiling is already enabled.
*/
public static final int CUDA_ERROR_PROFILER_ALREADY_STARTED = 7;
@@ -95,8 +95,8 @@ public class CUresult {
* This indicates profiler has already been stopped and probably
* cuProfilerStop() is incorrectly called.
*
* @deprecated This error return is deprecated as of CUDA 5.0.
* It is no longer an error to call cuProfilerStop() when
* @deprecated This error return is deprecated as of CUDA 5.0.
* It is no longer an error to call cuProfilerStop() when
* profiling is already disabled.
*/
public static final int CUDA_ERROR_PROFILER_ALREADY_STOPPED = 8;
@@ -203,7 +203,7 @@ public class CUresult {
/**
* This indicates that the ::CUcontext passed to the API call can
* only be bound to a single CPU thread at a time but is already
* only be bound to a single CPU thread at a time but is already
* bound to a CPU thread.
*/
public static final int CUDA_ERROR_CONTEXT_ALREADY_IN_USE = 216;
@@ -307,7 +307,7 @@ public class CUresult {
/**
* This error indicates that a call to ::cuMemPeerRegister is trying to
* register memory from a context which has not had peer access
* enabled yet via ::cuCtxEnablePeerAccess(), or that
* enabled yet via ::cuCtxEnablePeerAccess(), or that
* ::cuCtxDisablePeerAccess() is trying to disable peer access
* which has not been enabled yet.
*/
@@ -347,15 +347,15 @@ public class CUresult {
/**
* A device-side assert triggered during kernel execution. The context
* cannot be used anymore, and must be destroyed. All existing device
* memory allocations from this context are invalid and must be
* cannot be used anymore, and must be destroyed. All existing device
* memory allocations from this context are invalid and must be
* reconstructed if the program is to continue using CUDA.
*/
public static final int CUDA_ERROR_ASSERT = 710;
/**
* This error indicates that the hardware resources required to enable
* peer access have been exhausted for one or more of the devices
* peer access have been exhausted for one or more of the devices
* passed to ::cuCtxEnablePeerAccess().
*/
public static final int CUDA_ERROR_TOO_MANY_PEERS = 711;

View File

@@ -13,8 +13,7 @@ import com.sun.jna.ptr.LongByReference;
public class Nvidia implements GPULister {
public static String TYPE = "CUDA";
@Override
public List<GPUDevice> getGpus() {
@Override public List<GPUDevice> getGpus() {
OS os = OS.getOS();
String path = os.getCUDALib();
if (path == null) {
@@ -62,11 +61,11 @@ public class Nvidia implements GPULister {
}
List<GPUDevice> devices = new ArrayList<>(count.getValue());
for (int num = 0; num < count.getValue(); num++) {
IntByReference aDevice = new IntByReference();
result = cudalib.cuDeviceGet(aDevice, num);
result = cudalib.cuDeviceGet(aDevice, num);
if (result != CUresult.CUDA_SUCCESS) {
System.out.println("Nvidia::getGpus cuDeviceGet failed (ret: " + CUresult.stringFor(result) + ")");
continue;
@@ -75,19 +74,21 @@ public class Nvidia implements GPULister {
IntByReference pciDomainId = new IntByReference();
IntByReference pciBusId = new IntByReference();
IntByReference pciDeviceId = new IntByReference();
result = cudalib.cuDeviceGetAttribute(pciDomainId, CUDeviceAttribute.CU_DEVICE_ATTRIBUTE_PCI_DOMAIN_ID, aDevice.getValue());
result = cudalib.cuDeviceGetAttribute(pciDomainId, CUDeviceAttribute.CU_DEVICE_ATTRIBUTE_PCI_DOMAIN_ID, aDevice.getValue());
if (result != CUresult.CUDA_SUCCESS) {
System.out.println("Nvidia::getGpus cuDeviceGetAttribute for CU_DEVICE_ATTRIBUTE_PCI_DOMAIN_ID failed (ret: " + CUresult.stringFor(result) + ")");
System.out
.println("Nvidia::getGpus cuDeviceGetAttribute for CU_DEVICE_ATTRIBUTE_PCI_DOMAIN_ID failed (ret: " + CUresult.stringFor(result) + ")");
continue;
}
result = cudalib.cuDeviceGetAttribute(pciBusId, CUDeviceAttribute.CU_DEVICE_ATTRIBUTE_PCI_BUS_ID, aDevice.getValue());
result = cudalib.cuDeviceGetAttribute(pciBusId, CUDeviceAttribute.CU_DEVICE_ATTRIBUTE_PCI_BUS_ID, aDevice.getValue());
if (result != CUresult.CUDA_SUCCESS) {
System.out.println("Nvidia::getGpus cuDeviceGetAttribute for CU_DEVICE_ATTRIBUTE_PCI_BUS_ID failed (ret: " + CUresult.stringFor(result) + ")");
continue;
}
result = cudalib.cuDeviceGetAttribute(pciDeviceId, CUDeviceAttribute.CU_DEVICE_ATTRIBUTE_PCI_DEVICE_ID, aDevice.getValue());
result = cudalib.cuDeviceGetAttribute(pciDeviceId, CUDeviceAttribute.CU_DEVICE_ATTRIBUTE_PCI_DEVICE_ID, aDevice.getValue());
if (result != CUresult.CUDA_SUCCESS) {
System.out.println("Nvidia::getGpus cuDeviceGetAttribute for CU_DEVICE_ATTRIBUTE_PCI_DEVICE_ID failed (ret: " + CUresult.stringFor(result) + ")");
System.out
.println("Nvidia::getGpus cuDeviceGetAttribute for CU_DEVICE_ATTRIBUTE_PCI_DEVICE_ID failed (ret: " + CUresult.stringFor(result) + ")");
continue;
}
@@ -113,11 +114,8 @@ public class Nvidia implements GPULister {
return null;
}
String blenderId = String.format("CUDA_%s_%04x:%02x:%02x",
new String(name).trim(),
pciDomainId.getValue(),
pciBusId.getValue(),
pciDeviceId.getValue());
String blenderId = String
.format("CUDA_%s_%04x:%02x:%02x", new String(name).trim(), pciDomainId.getValue(), pciBusId.getValue(), pciDeviceId.getValue());
GPUDevice gpu = new GPUDevice(TYPE, new String(name).trim(), ram.getValue(), blenderId);
// for backward compatibility generate a CUDA_N id
gpu.setOldId(TYPE + "_" + num);
@@ -127,14 +125,12 @@ public class Nvidia implements GPULister {
return devices;
}
@Override
public int getRecommendedRenderBucketSize(long memory) {
@Override public int getRecommendedRenderBucketSize(long memory) {
// Optimal CUDA-based GPUs Renderbucket algorithm
return (memory > 1073741824L) ? 256 : 128;
}
@Override
public int getMaximumRenderBucketSize(long memory) {
@Override public int getMaximumRenderBucketSize(long memory) {
return (memory > 1073741824L) ? 512 : 128;
}
}

View File

@@ -2,7 +2,7 @@
* Copyright (C) 2013-2014 Laurent CLOUET
* Author Laurent CLOUET <laurent.clouet@nopnop.net>
*
* This program is free software; you can redistribute it and/or
* 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.
@@ -34,8 +34,7 @@ import com.sun.jna.ptr.IntByReference;
public class OpenCL implements GPULister {
public static String TYPE = "OPENCL";
@Override
public List<GPUDevice> getGpus() {
@Override public List<GPUDevice> getGpus() {
OpenCLLib lib = null;
String path = "OpenCL";
@@ -123,14 +122,12 @@ public class OpenCL implements GPULister {
return available_devices;
}
@Override
public int getRecommendedRenderBucketSize(long memory) {
@Override public int getRecommendedRenderBucketSize(long memory) {
// Optimal CUDA-based GPUs Renderbucket algorithm
return (memory > 1073741824L) ? 256 : 128;
}
@Override
public int getMaximumRenderBucketSize(long memory) {
@Override public int getMaximumRenderBucketSize(long memory) {
return (memory > 1073741824L) ? 2048 : 128;
}
@@ -181,7 +178,7 @@ public class OpenCL implements GPULister {
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]);
}
}

View File

@@ -2,7 +2,7 @@
* Copyright (C) 2013-2014 Laurent CLOUET
* Author Laurent CLOUET <laurent.clouet@nopnop.net>
*
* This program is free software; you can redistribute it and/or
* 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.
@@ -55,7 +55,8 @@ public interface OpenCLLib extends Library {
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 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[]);
@@ -65,8 +66,7 @@ public interface OpenCLLib extends Library {
public int id;
@Override
protected List<String> getFieldOrder() {
@Override protected List<String> getFieldOrder() {
return Arrays.asList(new String[] { "id" });
}
}
@@ -77,8 +77,7 @@ public interface OpenCLLib extends Library {
public int id;
@Override
protected List<String> getFieldOrder() {
@Override protected List<String> getFieldOrder() {
return Arrays.asList(new String[] { "id" });
}
}