Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: necst/grcuda
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: grcuda-0.4.0
Choose a base ref
...
head repository: necst/grcuda
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
  • 4 commits
  • 25 files changed
  • 3 contributors

Commits on Sep 21, 2022

  1. Added Java implementation of the benchmark suite (#49)

    Implemented the main benchmarks present in the Python suite in Java. The class Benchmark.java provides a template for future use cases. Created configuration files to easily adapt the benchmarks to different types of workloads.
    The suite is built as a Maven project, indeed running mvn test will execute all the benchmarks based on the configuration file of the appropriate GPU architecture.
    ian-ofgod authored Sep 21, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    85dcf30 View commit details

Commits on Mar 20, 2023

  1. Grcuda 132 refactor deviceselectionpolicy in grcudastreampolicy (#50)

    * Each policy type has a separated class
    
    * Keep only retrieveImpl
    
    * Now TransferTimeDeviceSelectionPolicy extends DeviceSelectionPolicy
    
    * Delete previously commented methods and clean code
    
    * added license for each file
    DavideMaffi authored Mar 20, 2023
    Copy the full SHA
    7208790 View commit details

Commits on Jul 18, 2023

  1. Copy the full SHA
    84b07b4 View commit details

Commits on Jul 19, 2023

  1. [GRCUDA-hotfix] move B9M into the Java benchmark suite (#52)

    * Add B9M + updated config files
    
    * Minor fix - deleted replicated B9M entry
    ian-ofgod authored Jul 19, 2023
    Copy the full SHA
    ca826df View commit details
Showing with 3,594 additions and 472 deletions.
  1. +40 −8 ...a.grcuda.test/src/com/nvidia/grcuda/test/runtime/executioncontext/GrCUDAStreamPolicyMockTest.java
  2. +35 −1 projects/com.nvidia.grcuda/src/com/nvidia/grcuda/runtime/stream/policy/DeviceSelectionPolicy.java
  3. +30 −0 ...ects/com.nvidia.grcuda/src/com/nvidia/grcuda/runtime/stream/policy/DeviceSelectionPolicyEnum.java
  4. +30 −0 projects/com.nvidia.grcuda/src/com/nvidia/grcuda/runtime/stream/policy/GrCUDADevicesManager.java
  5. +37 −463 projects/com.nvidia.grcuda/src/com/nvidia/grcuda/runtime/stream/policy/GrCUDAStreamPolicy.java
  6. +170 −0 ...grcuda/src/com/nvidia/grcuda/runtime/stream/policy/MinimizeTransferSizeDeviceSelectionPolicy.java
  7. +67 −0 ...om.nvidia.grcuda/src/com/nvidia/grcuda/runtime/stream/policy/RoundRobinDeviceSelectionPolicy.java
  8. +52 −0 ...ts/com.nvidia.grcuda/src/com/nvidia/grcuda/runtime/stream/policy/SingleDeviceSelectionPolicy.java
  9. +53 −0 ...m.nvidia.grcuda/src/com/nvidia/grcuda/runtime/stream/policy/StreamAwareDeviceSelectionPolicy.java
  10. +309 −0 ....nvidia.grcuda/src/com/nvidia/grcuda/runtime/stream/policy/TransferTimeDeviceSelectionPolicy.java
  11. +92 −0 projects/resources/java/grcuda-benchmark/pom.xml
  12. +213 −0 projects/resources/java/grcuda-benchmark/src/main/java/it/necst/grcuda/benchmark/Benchmark.java
  13. +105 −0 ...ects/resources/java/grcuda-benchmark/src/main/java/it/necst/grcuda/benchmark/BenchmarkConfig.java
  14. +154 −0 ...cts/resources/java/grcuda-benchmark/src/main/java/it/necst/grcuda/benchmark/BenchmarkResults.java
  15. +162 −0 projects/resources/java/grcuda-benchmark/src/main/java/it/necst/grcuda/benchmark/bench/B1.java
  16. +231 −0 projects/resources/java/grcuda-benchmark/src/main/java/it/necst/grcuda/benchmark/bench/B11M.java
  17. +195 −0 projects/resources/java/grcuda-benchmark/src/main/java/it/necst/grcuda/benchmark/bench/B1M.java
  18. +218 −0 projects/resources/java/grcuda-benchmark/src/main/java/it/necst/grcuda/benchmark/bench/B5M.java
  19. +519 −0 projects/resources/java/grcuda-benchmark/src/main/java/it/necst/grcuda/benchmark/bench/B6M.java
  20. +375 −0 projects/resources/java/grcuda-benchmark/src/main/java/it/necst/grcuda/benchmark/bench/B9M.java
  21. +331 −0 projects/resources/java/grcuda-benchmark/src/test/java/it/necst/grcuda/benchmark/TestBenchmarks.java
  22. +48 −0 projects/resources/java/grcuda-benchmark/src/test/java/it/necst/grcuda/benchmark/config_A100.json
  23. +36 −0 ...resources/java/grcuda-benchmark/src/test/java/it/necst/grcuda/benchmark/config_GTX1660_super.json
  24. +44 −0 projects/resources/java/grcuda-benchmark/src/test/java/it/necst/grcuda/benchmark/config_GTX960.json
  25. +48 −0 projects/resources/java/grcuda-benchmark/src/test/java/it/necst/grcuda/benchmark/config_V100.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,33 @@
/*
* Copyright (c) 2020, 2021, NECSTLab, Politecnico di Milano. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of NECSTLab nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
* * Neither the name of Politecnico di Milano nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.nvidia.grcuda.test.runtime.executioncontext;

import com.nvidia.grcuda.GrCUDAOptionMap;
@@ -7,6 +37,8 @@
import com.nvidia.grcuda.runtime.computation.dependency.DependencyPolicyEnum;
import com.nvidia.grcuda.runtime.stream.policy.DeviceSelectionPolicyEnum;
import com.nvidia.grcuda.runtime.stream.policy.GrCUDAStreamPolicy;
import com.nvidia.grcuda.runtime.stream.policy.RoundRobinDeviceSelectionPolicy;
import com.nvidia.grcuda.runtime.stream.policy.TransferTimeDeviceSelectionPolicy;
import com.nvidia.grcuda.runtime.stream.policy.RetrieveNewStreamPolicyEnum;
import com.nvidia.grcuda.runtime.stream.policy.RetrieveParentStreamPolicyEnum;
import com.nvidia.grcuda.test.util.mock.AsyncGrCUDAExecutionContextMock;
@@ -41,14 +73,14 @@ private static AsyncGrCUDAExecutionContextMock createContext(int numberOfGPUs, D
);
}

private GrCUDAStreamPolicy.RoundRobinDeviceSelectionPolicy getRoundRobinPolicy(int numGPUs) {
private RoundRobinDeviceSelectionPolicy getRoundRobinPolicy(int numGPUs) {
GrCUDADevicesManagerMock devicesManager = new GrCUDADevicesManagerMock(new DeviceListMock(numGPUs), numGPUs);
return new GrCUDAStreamPolicy.RoundRobinDeviceSelectionPolicy(devicesManager);
return new RoundRobinDeviceSelectionPolicy(devicesManager);
}

@Test
public void roundRobinTest() {
GrCUDAStreamPolicy.RoundRobinDeviceSelectionPolicy policy = getRoundRobinPolicy(4);
RoundRobinDeviceSelectionPolicy policy = getRoundRobinPolicy(4);
Device d = policy.retrieve(null);
assertEquals(0, d.getDeviceId());
assertEquals(1, policy.getInternalState());
@@ -126,7 +158,7 @@ public void createBandwidthMatrixTest() {
{45, 60, 20},
{10, 20, 0}
};
double[][] b = ((GrCUDAStreamPolicy.TransferTimeDeviceSelectionPolicy) streamPolicy.getDeviceSelectionPolicy()).getLinkBandwidth();
double[][] b = ((TransferTimeDeviceSelectionPolicy) streamPolicy.getDeviceSelectionPolicy()).getLinkBandwidth();
for (int i = 0; i < b.length; i++) {
for (int j = 0; j < b[i].length; j++) {
assertEquals(bGold[i][j], b[i][j], 1e-6);
@@ -137,7 +169,7 @@ public void createBandwidthMatrixTest() {
@Test
public void bandwidthComputationMinMaxTest() {
AsyncGrCUDAExecutionContextMock context = createContext(2, DeviceSelectionPolicyEnum.MINMAX_TRANSFER_TIME);
GrCUDAStreamPolicy.TransferTimeDeviceSelectionPolicy deviceSelectionPolicy = (GrCUDAStreamPolicy.TransferTimeDeviceSelectionPolicy) ((GrCUDAStreamPolicyMock) context.getStreamManager().getStreamPolicy()).getDeviceSelectionPolicy();
TransferTimeDeviceSelectionPolicy deviceSelectionPolicy = (TransferTimeDeviceSelectionPolicy) ((GrCUDAStreamPolicyMock) context.getStreamManager().getStreamPolicy()).getDeviceSelectionPolicy();
// If data is updated on the target device, we have infinite bandwidth (regardless of what's on the matrix diagonal);
double b = deviceSelectionPolicy.computeBandwidth(0, new HashSet<>(Arrays.asList(0, 1, CPUDevice.CPU_DEVICE_ID)));
assertEquals(Double.POSITIVE_INFINITY, b, 1e-6);
@@ -149,7 +181,7 @@ public void bandwidthComputationMinMaxTest() {
@Test
public void bandwidthComputationMinMinTest() {
AsyncGrCUDAExecutionContextMock context = createContext(2, DeviceSelectionPolicyEnum.MINMIN_TRANSFER_TIME);
GrCUDAStreamPolicy.TransferTimeDeviceSelectionPolicy deviceSelectionPolicy = (GrCUDAStreamPolicy.TransferTimeDeviceSelectionPolicy) ((GrCUDAStreamPolicyMock) context.getStreamManager().getStreamPolicy()).getDeviceSelectionPolicy();
TransferTimeDeviceSelectionPolicy deviceSelectionPolicy = (TransferTimeDeviceSelectionPolicy) ((GrCUDAStreamPolicyMock) context.getStreamManager().getStreamPolicy()).getDeviceSelectionPolicy();
// If data is updated on the target device, we have infinite bandwidth (regardless of what's on the matrix diagonal);
double b = deviceSelectionPolicy.computeBandwidth(0, new HashSet<>(Arrays.asList(0, 1, CPUDevice.CPU_DEVICE_ID)));
assertEquals(Double.POSITIVE_INFINITY, b, 1e-6);
@@ -161,15 +193,15 @@ public void bandwidthComputationMinMinTest() {
@Test(expected = IllegalStateException.class)
public void bandwidthComputationWithNoUpdatedLocationTest() {
AsyncGrCUDAExecutionContextMock context = createContext(2, DeviceSelectionPolicyEnum.MINMAX_TRANSFER_TIME);
GrCUDAStreamPolicy.TransferTimeDeviceSelectionPolicy deviceSelectionPolicy = (GrCUDAStreamPolicy.TransferTimeDeviceSelectionPolicy) ((GrCUDAStreamPolicyMock) context.getStreamManager().getStreamPolicy()).getDeviceSelectionPolicy();
TransferTimeDeviceSelectionPolicy deviceSelectionPolicy = (TransferTimeDeviceSelectionPolicy) ((GrCUDAStreamPolicyMock) context.getStreamManager().getStreamPolicy()).getDeviceSelectionPolicy();
// If the data is not available on any device, give an error;
double b = deviceSelectionPolicy.computeBandwidth(0, new HashSet<>());
}

@Test(expected = ArrayIndexOutOfBoundsException.class)
public void bandwidthComputationOutOfBoundsLocationTest() {
AsyncGrCUDAExecutionContextMock context = createContext(2, DeviceSelectionPolicyEnum.MINMAX_TRANSFER_TIME);
GrCUDAStreamPolicy.TransferTimeDeviceSelectionPolicy deviceSelectionPolicy = (GrCUDAStreamPolicy.TransferTimeDeviceSelectionPolicy) ((GrCUDAStreamPolicyMock) context.getStreamManager().getStreamPolicy()).getDeviceSelectionPolicy();
TransferTimeDeviceSelectionPolicy deviceSelectionPolicy = (TransferTimeDeviceSelectionPolicy) ((GrCUDAStreamPolicyMock) context.getStreamManager().getStreamPolicy()).getDeviceSelectionPolicy();
// If the data is not available on any device, give an error;
double b = deviceSelectionPolicy.computeBandwidth(10, new HashSet<>(Collections.singletonList(1)));
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,43 @@
/*
* Copyright (c) 2020, 2021, NECSTLab, Politecnico di Milano. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of NECSTLab nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
* * Neither the name of Politecnico di Milano nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.nvidia.grcuda.runtime.stream.policy;

import com.nvidia.grcuda.GrCUDAException;
import com.nvidia.grcuda.runtime.Device;
import com.nvidia.grcuda.runtime.array.AbstractArray;
import com.nvidia.grcuda.runtime.executioncontext.ExecutionDAG;

import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;

/**
* When using multiple GPUs, selecting the stream where a computation is executed implies
@@ -47,7 +79,9 @@ public Device retrieve(ExecutionDAG.DAGVertex vertex, List<Device> devices) {
} else if (devices.size() == 0) {
throw new GrCUDAException("the list of devices where the computation can be executed is empty");
} else {
return this.retrieveImpl(vertex, devices);
// Sort the devices by ID;
List<Device> sortedDevices = devices.stream().sorted(Comparator.comparingInt(Device::getDeviceId)).collect(Collectors.toList());
return this.retrieveImpl(vertex, sortedDevices);
}
}

Original file line number Diff line number Diff line change
@@ -1,3 +1,33 @@
/*
* Copyright (c) 2020, 2021, NECSTLab, Politecnico di Milano. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of NECSTLab nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
* * Neither the name of Politecnico di Milano nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.nvidia.grcuda.runtime.stream.policy;

public enum DeviceSelectionPolicyEnum {
Original file line number Diff line number Diff line change
@@ -1,3 +1,33 @@
/*
* Copyright (c) 2020, 2021, NECSTLab, Politecnico di Milano. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of NECSTLab nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
* * Neither the name of Politecnico di Milano nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.nvidia.grcuda.runtime.stream.policy;

import java.util.Collection;
Loading