Skip to content

Commit

Permalink
Remove {get,set}CurrentDevice() from CUDAService (#418)
Browse files Browse the repository at this point in the history
  • Loading branch information
makortel authored and fwyzard committed Nov 28, 2019
1 parent 7c8078d commit cb27c23
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 20 deletions.
6 changes: 0 additions & 6 deletions HeterogeneousCore/CUDAServices/interface/CUDAService.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,6 @@ class CUDAService {
// Returns the id of device with most free memory. If none is found, returns -1.
int deviceWithMostFreeMemory() const;

// Set the current device
void setCurrentDevice(int device) const;

// Get the current device
int getCurrentDevice() const;

private:
int numberOfDevices_ = 0;
std::vector<std::pair<int, int>> computeCapabilities_;
Expand Down
4 changes: 0 additions & 4 deletions HeterogeneousCore/CUDAServices/src/CUDAService.cc
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,3 @@ int CUDAService::deviceWithMostFreeMemory() const {
cudaCheck(cudaSetDevice(currentDevice));
return device;
}

void CUDAService::setCurrentDevice(int device) const { cudaCheck(cudaSetDevice(device)); }

int CUDAService::getCurrentDevice() const { return cudautils::currentDevice(); }
10 changes: 0 additions & 10 deletions HeterogeneousCore/CUDAServices/test/testCUDAService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,16 +111,6 @@ TEST_CASE("Tests of CUDAService", "[CUDAService]") {
WARN("Device with most free memory " << dev << "\n"
<< " as given by CUDAService " << cs.deviceWithMostFreeMemory());
}

SECTION("CUDAService set/get the current device") {
for (int i = 0; i < deviceCount; ++i) {
cs.setCurrentDevice(i);
int device = -1;
cudaGetDevice(&device);
REQUIRE(device == i);
REQUIRE(device == cs.getCurrentDevice());
}
}
}

SECTION("Force to be disabled") {
Expand Down

0 comments on commit cb27c23

Please sign in to comment.