87 lines
2.3 KiB
C++
87 lines
2.3 KiB
C++
/*!
|
|
* \file
|
|
* \brief Build and runtime configuration file.
|
|
*
|
|
* \author
|
|
* Christos Choutouridis AEM:8997
|
|
* <cchoutou@ece.auth.gr>
|
|
*/
|
|
|
|
#ifndef CONFIG_H_
|
|
#define CONFIG_H_
|
|
|
|
#include <cstdint>
|
|
#include <cuda_runtime.h>
|
|
|
|
/*
|
|
* 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.4";
|
|
|
|
/*
|
|
* Defines for different version of the exercise
|
|
*/
|
|
#define V0 0
|
|
#define V1 1
|
|
#define V2 2
|
|
#define SERIAL 's'
|
|
|
|
// Fail-safe version selection
|
|
#if !defined CODE_VERSION
|
|
#define CODE_VERSION V2
|
|
#endif
|
|
|
|
// Default Data size (in case -q <N> is not present)
|
|
static constexpr size_t DEFAULT_DATA_SIZE = 1 << 16;
|
|
|
|
// Placeholder default (actual default comes from device properties read at initialization)
|
|
static constexpr size_t THREADS_PER_BLOCK = 1024;
|
|
|
|
|
|
/*!
|
|
* Value and Buffer type selection
|
|
*
|
|
* We support the following compiler types or the <cstdint> that translate to them:
|
|
* char - unsigned char
|
|
* short - unsigned short
|
|
* int - unsigned int
|
|
* long - unsigned long
|
|
* long long - unsigned long long
|
|
* float
|
|
* double
|
|
*/
|
|
using Value_t = uint32_t;
|
|
using Data_t = std::vector<Value_t>;
|
|
|
|
/*!
|
|
* In theory we can support large arrays ;)
|
|
*/
|
|
using ArraySize_t = uint64_t;
|
|
|
|
/*!
|
|
* Session option for each invocation of the executable.
|
|
*
|
|
* @note
|
|
* The values of the members are set from the command line.
|
|
*/
|
|
struct config_t {
|
|
ArraySize_t arraySize{DEFAULT_DATA_SIZE}; //!< The array size of the local data to sort.
|
|
size_t blockSize{THREADS_PER_BLOCK}; //!< The block size (threads per block) for the session.
|
|
bool validation{false}; //!< Request a full validation at the end, performed by process rank 0.
|
|
size_t perf{1}; //!< Enable performance timing measurements and prints. Repeat
|
|
//!< the sorting <perf> times to do so.
|
|
bool verbose{false}; //!< Flag to enable verbose output to stdout.
|
|
};
|
|
|
|
/*
|
|
* Exported data types
|
|
*/
|
|
extern config_t config;
|
|
extern cudaDeviceProp device;
|
|
|
|
#endif /* CONFIG_H_ */
|