-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added printouts about the CUDA device being used in some places.
In order to help with debugging issues on multi-CUDA-GPU systems, added some printouts of the device name wherever it would be possible. At the same time simplified the build configuration of vecmem::cuda a bit, since the library doesn't actually build any CUDA code.
Showing
7 changed files
with
102 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* VecMem project, part of the ACTS project (R&D line) | ||
* | ||
* (c) 2022 CERN for the benefit of the ACTS project | ||
* | ||
* Mozilla Public License Version 2.0 | ||
*/ | ||
|
||
// Local include(s). | ||
#include "get_device_name.hpp" | ||
|
||
// CUDA include(s). | ||
#include <cuda_runtime_api.h> | ||
|
||
// System include(s). | ||
#include <sstream> | ||
|
||
namespace vecmem { | ||
namespace cuda { | ||
namespace details { | ||
|
||
std::string get_device_name(int device) { | ||
|
||
// Get the device's properties. | ||
cudaDeviceProp props; | ||
if (cudaGetDeviceProperties(&props, device) != cudaSuccess) { | ||
return "Unknown"; | ||
} | ||
|
||
// Construct a unique name out of those properties. | ||
std::ostringstream result; | ||
result << props.name << " [id: " << device << ", bus: " << props.pciBusID | ||
<< ", device: " << props.pciDeviceID << "]"; | ||
return result.str(); | ||
} | ||
|
||
} // namespace details | ||
} // namespace cuda | ||
} // namespace vecmem |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* VecMem project, part of the ACTS project (R&D line) | ||
* | ||
* (c) 2022 CERN for the benefit of the ACTS project | ||
* | ||
* Mozilla Public License Version 2.0 | ||
*/ | ||
#pragma once | ||
|
||
// System include(s). | ||
#include <string> | ||
|
||
namespace vecmem { | ||
namespace cuda { | ||
namespace details { | ||
|
||
/// Get a "fully qualified" name for a given CUDA device | ||
/// | ||
/// This function provides a uniform way for printing the names of the | ||
/// devices that various VecMem objects would be interacting with. | ||
/// | ||
/// @param device The device ID that the CUDA runtime assigned | ||
/// @return A user friently name for the device | ||
/// | ||
std::string get_device_name(int device); | ||
|
||
} // namespace details | ||
} // namespace cuda | ||
} // namespace vecmem |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters