Skip to content

Commit 0dfa526

Browse files
committed
Merge + spotless
2 parents ba036a2 + d32a466 commit 0dfa526

File tree

2 files changed

+7
-14
lines changed

2 files changed

+7
-14
lines changed

x-pack/plugin/gpu/src/main/java/org/elasticsearch/xpack/gpu/codec/CuVSResourceManager.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@
88
package org.elasticsearch.xpack.gpu.codec;
99

1010
import com.nvidia.cuvs.CuVSResources;
11-
1211
import com.nvidia.cuvs.GPUInfoProvider;
13-
1412
import com.nvidia.cuvs.spi.CuVSProvider;
1513

1614
import org.elasticsearch.core.Strings;
@@ -83,8 +81,8 @@ class PoolingCuVSResourceManager implements CuVSResourceManager {
8381
static final GPUInfoProvider gpuInfoProvider = CuVSProvider.provider().gpuInfoProvider();
8482
static final PoolingCuVSResourceManager INSTANCE = new PoolingCuVSResourceManager(
8583
MAX_RESOURCES,
86-
res ->gpuInfoProvider.getCurrentInfo(res).totalDeviceMemoryInBytes(),
87-
res ->gpuInfoProvider.getCurrentInfo(res).freeDeviceMemoryInBytes(),
84+
res -> gpuInfoProvider.getCurrentInfo(res).totalDeviceMemoryInBytes(),
85+
res -> gpuInfoProvider.getCurrentInfo(res).freeDeviceMemoryInBytes(),
8886
PoolingCuVSResourceManager::getGpuUtilizationPercent
8987
);
9088

@@ -104,7 +102,7 @@ public PoolingCuVSResourceManager(
104102
GpuInfoFunction totalMemoryInBytesProvider,
105103
GpuInfoFunction freeMemoryInBytesProvider,
106104
GpuInfoFunction gpuUtilizationPercentProvider
107-
) {
105+
) {
108106
this.totalMemoryInBytesProvider = totalMemoryInBytesProvider;
109107
this.freeMemoryInBytesProvider = freeMemoryInBytesProvider;
110108
this.gpuUtilizationPercentProvider = gpuUtilizationPercentProvider;
@@ -193,7 +191,7 @@ public ManagedCuVSResources acquire(int numVectors, int dims) throws Interrupted
193191
}
194192

195193
private long estimateRequiredMemory(int numVectors, int dims) {
196-
return (long)(GPU_COMPUTATION_MEMORY_FACTOR * numVectors * dims * Float.BYTES);
194+
return (long) (GPU_COMPUTATION_MEMORY_FACTOR * numVectors * dims * Float.BYTES);
197195
}
198196

199197
private static int getGpuUtilizationPercent(CuVSResources resources) {

x-pack/plugin/gpu/src/test/java/org/elasticsearch/xpack/gpu/codec/CuVSResourceManagerTests.java

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
package org.elasticsearch.xpack.gpu.codec;
99

1010
import com.nvidia.cuvs.CuVSResources;
11-
1211
import com.nvidia.cuvs.CuVSResourcesInfo;
1312
import com.nvidia.cuvs.GPUInfo;
1413
import com.nvidia.cuvs.GPUInfoProvider;
@@ -145,11 +144,7 @@ static class MockPoolingCuVSResourceManager extends CuVSResourceManager.PoolingC
145144
}
146145

147146
private MockPoolingCuVSResourceManager(int capacity, List<Long> allocationList) {
148-
super(
149-
capacity,
150-
res -> TOTAL_DEVICE_MEMORY_IN_BYTES,
151-
res ->freeMemoryFunction(allocationList),
152-
res -> 50);
147+
super(capacity, res -> TOTAL_DEVICE_MEMORY_IN_BYTES, res -> freeMemoryFunction(allocationList), res -> 50);
153148
this.allocations = allocationList;
154149
}
155150

@@ -165,8 +160,8 @@ protected CuVSResources createNew() {
165160
@Override
166161
public ManagedCuVSResources acquire(int numVectors, int dims) throws InterruptedException {
167162
var res = super.acquire(numVectors, dims);
168-
long memory = (long)(numVectors * dims * Float.BYTES *
169-
CuVSResourceManager.PoolingCuVSResourceManager.GPU_COMPUTATION_MEMORY_FACTOR);
163+
long memory = (long) (numVectors * dims * Float.BYTES
164+
* CuVSResourceManager.PoolingCuVSResourceManager.GPU_COMPUTATION_MEMORY_FACTOR);
170165
allocations.add(memory);
171166
log.info("Added [{}]", memory);
172167
return res;

0 commit comments

Comments
 (0)