AUTH's THMMY "Parallel and distributed systems" course assignments.
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 
 
 

87 lignes
2.3 KiB

  1. /*!
  2. * \file
  3. * \brief Build and runtime configuration file.
  4. *
  5. * \author
  6. * Christos Choutouridis AEM:8997
  7. * <cchoutou@ece.auth.gr>
  8. */
  9. #ifndef CONFIG_H_
  10. #define CONFIG_H_
  11. #include <cstdint>
  12. #include <cuda_runtime.h>
  13. /*
  14. * Versioning:
  15. * - RC1: First version to test on HPC
  16. * - RC2: A prephase added for v1 and v2
  17. * - RC3: V2 code refactor version measurements ** Not in the master branch
  18. * - RC4: Measurements version
  19. */
  20. static constexpr char version[] = "0.4";
  21. /*
  22. * Defines for different version of the exercise
  23. */
  24. #define V0 0
  25. #define V1 1
  26. #define V2 2
  27. #define SERIAL 's'
  28. // Fail-safe version selection
  29. #if !defined CODE_VERSION
  30. #define CODE_VERSION V2
  31. #endif
  32. // Default Data size (in case -q <N> is not present)
  33. static constexpr size_t DEFAULT_DATA_SIZE = 1 << 16;
  34. // Placeholder default (actual default comes from device properties read at initialization)
  35. static constexpr size_t THREADS_PER_BLOCK = 1024;
  36. /*!
  37. * Value and Buffer type selection
  38. *
  39. * We support the following compiler types or the <cstdint> that translate to them:
  40. * char - unsigned char
  41. * short - unsigned short
  42. * int - unsigned int
  43. * long - unsigned long
  44. * long long - unsigned long long
  45. * float
  46. * double
  47. */
  48. using Value_t = uint32_t;
  49. using Data_t = std::vector<Value_t>;
  50. /*!
  51. * In theory we can support large arrays ;)
  52. */
  53. using ArraySize_t = uint64_t;
  54. /*!
  55. * Session option for each invocation of the executable.
  56. *
  57. * @note
  58. * The values of the members are set from the command line.
  59. */
  60. struct config_t {
  61. ArraySize_t arraySize{DEFAULT_DATA_SIZE}; //!< The array size of the local data to sort.
  62. size_t blockSize{THREADS_PER_BLOCK}; //!< The block size (threads per block) for the session.
  63. bool validation{false}; //!< Request a full validation at the end, performed by process rank 0.
  64. size_t perf{1}; //!< Enable performance timing measurements and prints. Repeat
  65. //!< the sorting <perf> times to do so.
  66. bool verbose{false}; //!< Flag to enable verbose output to stdout.
  67. };
  68. /*
  69. * Exported data types
  70. */
  71. extern config_t config;
  72. extern cudaDeviceProp device;
  73. #endif /* CONFIG_H_ */