From 5c136c20b900b75756e9311da95de8c0f53361d4 Mon Sep 17 00:00:00 2001 From: Christos Choutouridis Date: Mon, 17 Feb 2025 00:11:13 +0200 Subject: [PATCH] HW3: RC4 - Ampere/Gpu measurements version --- homework_3/src/config.h | 5 ++++- homework_3/src/main.cpp | 24 ++++++++++++++---------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/homework_3/src/config.h b/homework_3/src/config.h index c2e9e0b..6dd5627 100644 --- a/homework_3/src/config.h +++ b/homework_3/src/config.h @@ -16,8 +16,11 @@ /* * Versioning: * - 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 diff --git a/homework_3/src/main.cpp b/homework_3/src/main.cpp index ebd3c3b..09d2fbe 100644 --- a/homework_3/src/main.cpp +++ b/homework_3/src/main.cpp @@ -175,18 +175,22 @@ bool validator(DataT& data) { void init(int* argc, char*** argv) { // Get device configuration - if (cudaGetDeviceProperties(&device, 0) != cudaSuccess) - throw std::runtime_error("[CUDA] - Can not read GPU"); - - config.blockSize = static_cast(device.maxThreadsPerBlock); + if (cudaGetDeviceProperties(&device, 0) == cudaSuccess){ + config.blockSize = static_cast(device.maxThreadsPerBlock); - // try to read command line - if (!get_options(*argc, *argv)) - exit(1); + // try to read command line + if (!get_options(*argc, *argv)) + exit(1); - // Prepare vector and timing data - Data.resize(config.arraySize); - measurements_init(); + // Prepare vector and timing data + Data.resize(config.arraySize); + 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