Browse Source

HW3: RC4 - Ampere/Gpu measurements version

master
parent
commit
5c136c20b9
2 changed files with 18 additions and 11 deletions
  1. +4
    -1
      homework_3/src/config.h
  2. +14
    -10
      homework_3/src/main.cpp

+ 4
- 1
homework_3/src/config.h View File

@@ -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


+ 14
- 10
homework_3/src/main.cpp View File

@@ -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<size_t>(device.maxThreadsPerBlock);
if (cudaGetDeviceProperties(&device, 0) == cudaSuccess){
config.blockSize = static_cast<size_t>(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


Loading…
Cancel
Save