AUTH's THMMY "Parallel and distributed systems" course assignments.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

config.h 2.6 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*!
  2. * \file config,h
  3. * \brief Build 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 <iostream>
  12. #include <string>
  13. #include <matrix.hpp>
  14. // HDF5 supported types
  15. enum class HDF5_type {
  16. SCHAR, CHAR, SHORT, USHORT, INT, UINT, LONG, ULONG, LLONG, ULLONG, FLOAT, DOUBLE
  17. };
  18. /*
  19. * Defines for different version of the exercise
  20. */
  21. #define V0 0
  22. #define V1 1
  23. // Fail-safe version selection
  24. #if !defined CODE_VERSION
  25. #define CODE_VERSION V1
  26. #endif
  27. // matrix alias template dispatcher based on pre-define flag from compiler (see Makefile)
  28. #if CODE_VERSION == V0
  29. #define NAMESPACE_VERSION using namespace v0
  30. using MatrixDst = mtx::Matrix<double>;
  31. using MatrixIdx = mtx::Matrix<uint32_t>;
  32. static constexpr HDF5_type DstHDF5Type = HDF5_type::DOUBLE;
  33. static constexpr HDF5_type IdxHDF5Type = HDF5_type::INT;
  34. #elif CODE_VERSION == V1
  35. #define NAMESPACE_VERSION using namespace v1
  36. using MatrixDst = mtx::Matrix<double>;
  37. using MatrixIdx = mtx::Matrix<uint32_t>;
  38. static constexpr HDF5_type DstHDF5Type = HDF5_type::DOUBLE;
  39. static constexpr HDF5_type IdxHDF5Type = HDF5_type::INT;
  40. #endif
  41. //! enumerator for output handling
  42. enum class StdOutputMode{ STD, FILE };
  43. /*!
  44. * Session option for each invocation of the executable
  45. */
  46. struct session_t {
  47. std::string corpusMtxFile {}; //!< corpus matrix file name in HDF5 format
  48. std::string corpusDataSet {}; //!< corpus dataset name in HDF5 matrix file
  49. std::string queryMtxFile {}; //!< optional query matrix file name in HDF5 format
  50. std::string queryDataSet {}; //!< optional query dataset name in HDF5 matrix file
  51. bool queryMtx {false}; //!< Flag to indicate that there is a separate query matrix
  52. size_t k {1}; //!< The number of nearest neighbors to find
  53. std::string outMtxFile {"out.hdf5"}; //!< output matrix file name in HDF5 format
  54. std::string outMtxIdxDataSet {"/Idx"}; //!< Index output dataset name in HDF5 matrix file
  55. std::string outMtxDstDataSet {"/Dst"}; //!< Distance output dataset name in HDF5 matrix file
  56. std::size_t max_threads {}; //!< Maximum threads to use
  57. bool timing {false}; //!< Enable timing prints of the program
  58. bool verbose {false}; //!< Flag to enable verbose output to stdout
  59. };
  60. extern session_t session;
  61. #endif /* CONFIG_H_ */