HW3: RC4 - Ampere/Gpu measurements version

This commit is contained in:
Christos Choutouridis 2025-02-17 00:11:13 +02:00
parent f056b8c1cd
commit 5c136c20b9
2 changed files with 19 additions and 12 deletions

View File

@ -16,8 +16,11 @@
/* /*
* Versioning: * Versioning:
* - RC1: First version to test on HPC * - RC1: First version to test on HPC
* - RC2: A prephase added for v1 and v2
* - RC3: V2 code refactor version measurements ** Not in the master branch
* - RC4: Measurements version
*/ */
static constexpr char version[] = "0.1"; static constexpr char version[] = "0.4";
/* /*
* Defines for different version of the exercise * Defines for different version of the exercise

View File

@ -175,9 +175,7 @@ bool validator(DataT& data) {
void init(int* argc, char*** argv) { void init(int* argc, char*** argv) {
// Get device configuration // Get device configuration
if (cudaGetDeviceProperties(&device, 0) != cudaSuccess) if (cudaGetDeviceProperties(&device, 0) == cudaSuccess){
throw std::runtime_error("[CUDA] - Can not read GPU");
config.blockSize = static_cast<size_t>(device.maxThreadsPerBlock); config.blockSize = static_cast<size_t>(device.maxThreadsPerBlock);
// try to read command line // try to read command line
@ -188,6 +186,12 @@ void init(int* argc, char*** argv) {
Data.resize(config.arraySize); Data.resize(config.arraySize);
measurements_init(); measurements_init();
} }
else {
// try to read command line for -h or --version
get_options(*argc, *argv);
throw std::runtime_error("[CUDA] - Can not read GPU");
}
}
#if !defined TESTING #if !defined TESTING
/*! /*!