diff --git a/CMakeLists.txt b/CMakeLists.txt index f2ba3bd..8cab505 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,11 +8,6 @@ set (CMAKE_CXX_STANDARD 20) include (set_max_warning_level) set_max_warning_level () -# Necessary to suppress the ... changes the meaning of symbol ... -if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive") -endif () - ################################################## Options ################################################## option(MPI_BUILD_TESTS "Build tests." OFF) option(MPI_USE_EXCEPTIONS "Use exceptions." OFF) diff --git a/include/mpi/core/communicators/cartesian_communicator.hpp b/include/mpi/core/communicators/cartesian_communicator.hpp index c9dee3f..dd9e6a7 100644 --- a/include/mpi/core/communicators/cartesian_communicator.hpp +++ b/include/mpi/core/communicators/cartesian_communicator.hpp @@ -142,7 +142,7 @@ class cartesian_communicator : public topological_communicator std::array shift (const std::int32_t dimension, const std::int32_t displacement = 1) const { std::array result {}; - MPI_CHECK_ERROR_CODE(MPI_Cart_shift, (native_, dimension, displacement, &result[0], &result[1])) + MPI_CHECK_ERROR_CODE(MPI_Cart_shift, (native_, dimension, displacement, result.data(), &result[1])) return result; } }; diff --git a/include/mpi/core/communicators/communicator.hpp b/include/mpi/core/communicators/communicator.hpp index 89b242f..f7881df 100644 --- a/include/mpi/core/communicators/communicator.hpp +++ b/include/mpi/core/communicators/communicator.hpp @@ -227,14 +227,14 @@ class communicator } [[nodiscard]] - group group () const + mpi::group group () const { mpi::group result(MPI_GROUP_NULL, true); MPI_CHECK_ERROR_CODE(MPI_Comm_group, (native_, &result.native_)) return result; } [[nodiscard]] - topology topology () const + mpi::topology topology () const { std::int32_t result; MPI_CHECK_ERROR_CODE(MPI_Topo_test, (native_, &result)) @@ -276,7 +276,7 @@ class communicator { std::string result(MPI_MAX_OBJECT_NAME, '\n'); std::int32_t length(0); - MPI_CHECK_ERROR_CODE(MPI_Comm_get_name, (native_, &result[0], &length)) + MPI_CHECK_ERROR_CODE(MPI_Comm_get_name, (native_, result.data(), &length)) result.resize(static_cast(length)); return result; } @@ -286,7 +286,7 @@ class communicator } [[nodiscard]] - information information () const + mpi::information information () const { mpi::information result(MPI_INFO_NULL, true); MPI_CHECK_ERROR_CODE(MPI_Comm_get_info, (native_, &result.native_)) @@ -553,7 +553,7 @@ class communicator request partitioned_send (const std::int32_t partitions, const void* data, const count size, const data_type& data_type, const std::int32_t destination, const std::int32_t tag = 0, const mpi::information& info = mpi::information()) const { request result(MPI_REQUEST_NULL, true, true); - MPI_CHECK_ERROR_CODE(MPI_Psend_init, (data, partitions, size, data_type.native(), destination, tag, native_, info.native(), &result.native_)) + MPI_CHECK_ERROR_CODE(MPI_Psend_init, (const_cast(data), partitions, size, data_type.native(), destination, tag, native_, info.native(), &result.native_)) // Note: Several implementations require the const_cast. return result; } template [[nodiscard]] @@ -1083,7 +1083,7 @@ class communicator received_type& received, const bool resize = false) const { - std::int32_t local_size (container_adapter::size(sent)); + const std::int32_t local_size (container_adapter::size(sent)); std::vector received_sizes(size()); all_gather(local_size, received_sizes); @@ -1108,7 +1108,7 @@ class communicator { using adapter = container_adapter; - std::int32_t local_size (adapter::size(data)); + const std::int32_t local_size (adapter::size(data)); std::vector received_sizes(size()); all_gather(local_size, received_sizes); diff --git a/include/mpi/core/communicators/distributed_graph_communicator.hpp b/include/mpi/core/communicators/distributed_graph_communicator.hpp index 9620a5f..b47d02d 100644 --- a/include/mpi/core/communicators/distributed_graph_communicator.hpp +++ b/include/mpi/core/communicators/distributed_graph_communicator.hpp @@ -73,7 +73,7 @@ class distributed_graph_communicator : public topological_communicator } [[nodiscard]] - neighbor_counts neighbor_counts () const + mpi::neighbor_counts neighbor_counts () const { mpi::neighbor_counts result {}; MPI_CHECK_ERROR_CODE(MPI_Dist_graph_neighbors_count, (native_, &result.source_count, &result.destination_count, reinterpret_cast(&result.weighted))) diff --git a/include/mpi/core/communicators/graph_communicator.hpp b/include/mpi/core/communicators/graph_communicator.hpp index 7e8b0d4..4bd51dc 100644 --- a/include/mpi/core/communicators/graph_communicator.hpp +++ b/include/mpi/core/communicators/graph_communicator.hpp @@ -50,11 +50,11 @@ class graph_communicator : public topological_communicator std::array counts () const { std::array result {}; - MPI_CHECK_ERROR_CODE(MPI_Graphdims_get, (native_, &result[0], &result[1])) + MPI_CHECK_ERROR_CODE(MPI_Graphdims_get, (native_, result.data(), &result[1])) return result; } [[nodiscard]] - graph graph () const + mpi::graph graph () const { const auto count = counts(); diff --git a/include/mpi/core/communicators/topological_communicator.hpp b/include/mpi/core/communicators/topological_communicator.hpp index c021fb6..8ee6442 100644 --- a/include/mpi/core/communicators/topological_communicator.hpp +++ b/include/mpi/core/communicators/topological_communicator.hpp @@ -306,7 +306,7 @@ class topological_communicator : public communicator received_type& received, const bool resize = false) const { - std::int32_t local_size (container_adapter::size(sent)); + const std::int32_t local_size (container_adapter::size(sent)); std::vector received_sizes(incoming_neighbor_count()); neighbor_all_gather(local_size, received_sizes); diff --git a/include/mpi/core/environment.hpp b/include/mpi/core/environment.hpp index 06d2b35..df21e23 100644 --- a/include/mpi/core/environment.hpp +++ b/include/mpi/core/environment.hpp @@ -66,7 +66,7 @@ inline std::string processor_name () { std::string result(MPI_MAX_PROCESSOR_NAME, '\n'); std::int32_t size (0); - MPI_CHECK_ERROR_CODE(MPI_Get_processor_name, (&result[0], &size)) + MPI_CHECK_ERROR_CODE(MPI_Get_processor_name, (result.data(), &size)) result.resize(static_cast(size)); return result; } diff --git a/include/mpi/core/error/error_class.hpp b/include/mpi/core/error/error_class.hpp index badec5b..48f6697 100644 --- a/include/mpi/core/error/error_class.hpp +++ b/include/mpi/core/error/error_class.hpp @@ -47,7 +47,7 @@ class error_class { std::string result(MPI_MAX_ERROR_STRING, '\n'); std::int32_t length(0); - MPI_Error_string(native_, &result[0], &length); + MPI_Error_string(native_, result.data(), &length); result.resize(static_cast(length)); return result; } diff --git a/include/mpi/core/information.hpp b/include/mpi/core/information.hpp index 016d755..750f2f0 100644 --- a/include/mpi/core/information.hpp +++ b/include/mpi/core/information.hpp @@ -158,7 +158,7 @@ class information return {std::nullopt}; std::string result(size, '\n'); - MPI_CHECK_ERROR_CODE(MPI_Info_get, (native_, key.c_str(), size, &result[0], &exists)) + MPI_CHECK_ERROR_CODE(MPI_Info_get, (native_, key.c_str(), size, result.data(), &exists)) return result; } @@ -167,7 +167,7 @@ class information std::string key_at (const std::int32_t index) const { std::string result(MPI_MAX_INFO_KEY, '\n'); - MPI_CHECK_ERROR_CODE(MPI_Info_get_nthkey, (native_, index, &result[0])) + MPI_CHECK_ERROR_CODE(MPI_Info_get_nthkey, (native_, index, result.data())) return result; } [[nodiscard]] diff --git a/include/mpi/core/port.hpp b/include/mpi/core/port.hpp index f9bb0b1..f4e9c1e 100644 --- a/include/mpi/core/port.hpp +++ b/include/mpi/core/port.hpp @@ -15,7 +15,7 @@ class port explicit port (const information& info = information()) : managed_(true), name_(MPI_MAX_PORT_NAME, '\n') { - MPI_CHECK_ERROR_CODE(MPI_Open_port, (info.native(), &name_[0])) + MPI_CHECK_ERROR_CODE(MPI_Open_port, (info.native(), name_.data())) } explicit port (std::string name, const bool managed = false) : managed_(managed), name_(std::move(name)) diff --git a/include/mpi/core/request.hpp b/include/mpi/core/request.hpp index f77c05e..94d036a 100644 --- a/include/mpi/core/request.hpp +++ b/include/mpi/core/request.hpp @@ -104,7 +104,7 @@ class request } void set_partition_ready(const std::vector& partitions) const { - MPI_CHECK_ERROR_CODE(MPI_Pready_list , (static_cast(partitions.size()), partitions.data(), native_)) + MPI_CHECK_ERROR_CODE(MPI_Pready_list , (static_cast(partitions.size()), const_cast(partitions.data()), native_)) // Note: Several implementations require the const_cast. } void set_partition_ready(const std::int32_t lower, const std::int32_t upper) const { diff --git a/include/mpi/core/service.hpp b/include/mpi/core/service.hpp index ca6f9c9..fe2d373 100644 --- a/include/mpi/core/service.hpp +++ b/include/mpi/core/service.hpp @@ -36,7 +36,7 @@ class service inline port lookup_service(const std::string& name, const information& info = information()) { std::string result(MPI_MAX_PORT_NAME, '\n'); - MPI_CHECK_ERROR_CODE(MPI_Lookup_name, (name.c_str(), info.native(), &result[0])) + MPI_CHECK_ERROR_CODE(MPI_Lookup_name, (name.c_str(), info.native(), result.data())) return port(result); // Unmanaged construction. } } \ No newline at end of file diff --git a/include/mpi/core/session.hpp b/include/mpi/core/session.hpp index 0b1e298..1b1e72a 100644 --- a/include/mpi/core/session.hpp +++ b/include/mpi/core/session.hpp @@ -16,7 +16,7 @@ namespace mpi class session { public: - session (const information& information, const session_error_handler& error_handler) + session (const mpi::information& information, const session_error_handler& error_handler) : managed_(true) { MPI_CHECK_ERROR_CODE(MPI_Session_init, (information.native(), error_handler.native(), &native_)) @@ -56,14 +56,14 @@ class session } [[nodiscard]] - std::int32_t process_set_count ( const information& information = mpi::information()) const + std::int32_t process_set_count ( const mpi::information& information = mpi::information()) const { std::int32_t result; MPI_CHECK_ERROR_CODE(MPI_Session_get_num_psets, (native_, information.native(), &result)) return result; } [[nodiscard]] - std::string process_set_name (const std::int32_t index, const information& information = mpi::information()) const + std::string process_set_name (const std::int32_t index, const mpi::information& information = mpi::information()) const { std::int32_t size (0); MPI_CHECK_ERROR_CODE(MPI_Session_get_nth_pset, (native_, information.native(), index, &size, nullptr )) @@ -73,7 +73,7 @@ class session return result; } [[nodiscard]] - information process_set_information(const std::string& name) const + mpi::information process_set_information(const std::string& name) const { mpi::information result(MPI_INFO_NULL, true); MPI_CHECK_ERROR_CODE(MPI_Session_get_pset_info, (native_, name.c_str(), &result.native_)) @@ -88,7 +88,7 @@ class session return std::stoi(*info["mpi_size"]); } [[nodiscard]] - std::vector process_sets (const information& information = mpi::information()) const + std::vector process_sets (const mpi::information& information = mpi::information()) const { std::vector result(process_set_count(information)); for (std::size_t i = 0; i < result.size(); ++i) @@ -100,7 +100,7 @@ class session } [[nodiscard]] - information information () const + mpi::information information () const { mpi::information result(MPI_INFO_NULL, true); MPI_CHECK_ERROR_CODE(MPI_Session_get_info, (native_, &result.native_)) diff --git a/include/mpi/core/status.hpp b/include/mpi/core/status.hpp index 96e593c..d275e95 100644 --- a/include/mpi/core/status.hpp +++ b/include/mpi/core/status.hpp @@ -12,7 +12,10 @@ namespace mpi class communicator; class message; class request; -class io::file; +namespace io +{ +class file; +} class status { diff --git a/include/mpi/core/structs/data_type_information.hpp b/include/mpi/core/structs/data_type_information.hpp index 7cc72e7..aab6aeb 100644 --- a/include/mpi/core/structs/data_type_information.hpp +++ b/include/mpi/core/structs/data_type_information.hpp @@ -11,9 +11,9 @@ class data_type; struct data_type_information { - std::vector integers ; - std::vector addresses ; - std::vector data_types; - combiner combiner ; + std::vector integers ; + std::vector addresses ; + std::vector data_types ; + mpi::combiner combiner {}; }; } \ No newline at end of file diff --git a/include/mpi/core/structs/spawn_information.hpp b/include/mpi/core/structs/spawn_information.hpp index 86d072d..c87c1bf 100644 --- a/include/mpi/core/structs/spawn_information.hpp +++ b/include/mpi/core/structs/spawn_information.hpp @@ -13,6 +13,6 @@ struct spawn_information std::string command ; std::vector arguments ; std::int32_t process_count; - information information ; + mpi::information information ; }; } \ No newline at end of file diff --git a/include/mpi/core/type/data_type.hpp b/include/mpi/core/type/data_type.hpp index 5598c12..32a413b 100644 --- a/include/mpi/core/type/data_type.hpp +++ b/include/mpi/core/type/data_type.hpp @@ -175,7 +175,7 @@ class data_type std::array extent () const { std::array result {}; - MPI_CHECK_ERROR_CODE(MPI_Type_get_extent, (native_, &result[0], &result[1])) + MPI_CHECK_ERROR_CODE(MPI_Type_get_extent, (native_, result.data(), &result[1])) MPI_CHECK_UNDEFINED (MPI_Type_get_extent, result[0]) MPI_CHECK_UNDEFINED (MPI_Type_get_extent, result[1]) return result; @@ -184,7 +184,7 @@ class data_type std::array extent_x () const { std::array result {}; - MPI_CHECK_ERROR_CODE(MPI_Type_get_extent_x, (native_, &result[0], &result[1])) + MPI_CHECK_ERROR_CODE(MPI_Type_get_extent_x, (native_, result.data(), &result[1])) MPI_CHECK_UNDEFINED (MPI_Type_get_extent_x, result[0]) MPI_CHECK_UNDEFINED (MPI_Type_get_extent_x, result[1]) return result; @@ -193,7 +193,7 @@ class data_type std::array true_extent () const { std::array result {}; - MPI_CHECK_ERROR_CODE(MPI_Type_get_true_extent, (native_, &result[0], &result[1])) + MPI_CHECK_ERROR_CODE(MPI_Type_get_true_extent, (native_, result.data(), &result[1])) MPI_CHECK_UNDEFINED (MPI_Type_get_true_extent, result[0]) MPI_CHECK_UNDEFINED (MPI_Type_get_true_extent, result[1]) return result; @@ -202,7 +202,7 @@ class data_type std::array true_extent_x () const { std::array result {}; - MPI_CHECK_ERROR_CODE(MPI_Type_get_true_extent_x, (native_, &result[0], &result[1])) + MPI_CHECK_ERROR_CODE(MPI_Type_get_true_extent_x, (native_, result.data(), &result[1])) MPI_CHECK_UNDEFINED (MPI_Type_get_true_extent_x, result[0]) MPI_CHECK_UNDEFINED (MPI_Type_get_true_extent_x, result[1]) return result; diff --git a/include/mpi/core/utility/container_adapter.hpp b/include/mpi/core/utility/container_adapter.hpp index 37ca106..dc517ba 100644 --- a/include/mpi/core/utility/container_adapter.hpp +++ b/include/mpi/core/utility/container_adapter.hpp @@ -22,24 +22,24 @@ class container_adapter::get_data_type(); } - static value_type* data ( type& container) + static value_type* data ( type& container) { return &container; } - static const value_type* data (const type& container) + static const value_type* data (const type& container) { return &container; } - static std::size_t size (const type& container) + static std::size_t size (const type& container) { return 1; } - static void resize ( type& container, const std::size_t size) + static void resize ( type& container, const std::size_t size) { // Do nothing. Compliant types are not resizable. } @@ -51,30 +51,30 @@ class container_adapter::get_data_type(); } - static value_type* data ( type& container) + static value_type* data ( type& container) { if constexpr (std::is_same_v>) return &container[0]; // std::valarray does not have a .data() function. else return container.data(); } - static const value_type* data (const type& container) + static const value_type* data (const type& container) { if constexpr (std::is_same_v>) return &container[0]; // std::valarray does not have a .data() function. else return container.data(); } - static std::size_t size (const type& container) + static std::size_t size (const type& container) { return container.size(); } - static void resize ( type& container, const std::size_t size) + static void resize ( type& container, const std::size_t size) { // Spans are not resizable. if constexpr (!is_span_v) diff --git a/include/mpi/core/version.hpp b/include/mpi/core/version.hpp index 72a0c5a..b987b8b 100644 --- a/include/mpi/core/version.hpp +++ b/include/mpi/core/version.hpp @@ -16,14 +16,14 @@ constexpr std::int32_t sub_version = MPI_SUBVERSION; inline std::array get_version () { std::array result {}; - MPI_CHECK_ERROR_CODE(MPI_Get_version, (&result[0], &result[1])) + MPI_CHECK_ERROR_CODE(MPI_Get_version, (result.data(), &result[1])) return result; } inline std::string get_library_version() { std::string result(MPI_MAX_LIBRARY_VERSION_STRING, '\n'); std::int32_t size (0); - MPI_CHECK_ERROR_CODE(MPI_Get_library_version, (&result[0], &size)) + MPI_CHECK_ERROR_CODE(MPI_Get_library_version, (result.data(), &size)) result.resize(static_cast(size)); return result; } diff --git a/include/mpi/core/window.hpp b/include/mpi/core/window.hpp index ba2e088..e46e6bf 100644 --- a/include/mpi/core/window.hpp +++ b/include/mpi/core/window.hpp @@ -101,7 +101,7 @@ class window } [[nodiscard]] - group group () const + mpi::group group () const { mpi::group result(MPI_GROUP_NULL, true); // Standard: ... should be freed with MPI_Group_free when it is no longer needed ... MPI_CHECK_ERROR_CODE(MPI_Win_get_group, (native_, &result.native_)) @@ -120,7 +120,7 @@ class window { std::string result(MPI_MAX_OBJECT_NAME, '\n'); std::int32_t length(0); - MPI_CHECK_ERROR_CODE(MPI_Win_get_name, (native_, &result[0], &length)) + MPI_CHECK_ERROR_CODE(MPI_Win_get_name, (native_, result.data(), &length)) result.resize(static_cast(length)); return result; } @@ -130,7 +130,7 @@ class window } [[nodiscard]] - information information () const + mpi::information information () const { mpi::information result(MPI_INFO_NULL, true); MPI_CHECK_ERROR_CODE(MPI_Win_get_info, (native_, &result.native_)) diff --git a/include/mpi/extensions/detach.hpp b/include/mpi/extensions/detach.hpp index 06bd327..8c2017f 100644 --- a/include/mpi/extensions/detach.hpp +++ b/include/mpi/extensions/detach.hpp @@ -31,16 +31,16 @@ class detach_context struct detach_state { - detach_state(request& req, detach_function func) + detach_state(mpi::request& req, detach_function func) : request (req.persistent() ? mpi::request(req.native(), false, true) : std::move(req)) // If persistent create an unmanaged copy, else move. , function(std::move(func)) { } - request request ; + mpi::request request ; detach_function function; - status status ; + mpi::status status ; }; struct detach_all_state { diff --git a/include/mpi/extensions/shared_variable.hpp b/include/mpi/extensions/shared_variable.hpp index 82acd23..0e6a1e7 100644 --- a/include/mpi/extensions/shared_variable.hpp +++ b/include/mpi/extensions/shared_variable.hpp @@ -22,9 +22,9 @@ class manual_shared_variable manual_shared_variable (const manual_shared_variable& that) = delete ; manual_shared_variable ( manual_shared_variable&& temp) = default; virtual ~manual_shared_variable () = default; - manual_shared_variable& operator=(const manual_shared_variable& that) = delete ; - manual_shared_variable& operator=( manual_shared_variable&& temp) = default; - manual_shared_variable& operator=(const type& value) + manual_shared_variable& operator= (const manual_shared_variable& that) = delete ; + manual_shared_variable& operator= ( manual_shared_variable&& temp) = default; + manual_shared_variable& operator= (const type& value) { set(value); return *this; diff --git a/include/mpi/io/data_representation.hpp b/include/mpi/io/data_representation.hpp index bec98a2..fe19199 100644 --- a/include/mpi/io/data_representation.hpp +++ b/include/mpi/io/data_representation.hpp @@ -25,7 +25,7 @@ class data_representation void* user_data ) : name_(std::move(name)) { - MPI_CHECK_ERROR_CODE(MPI_Register_datarep, (name.c_str(), read_function, write_function, extent_function, user_data)) + MPI_CHECK_ERROR_CODE(MPI_Register_datarep, (name_.c_str(), read_function, write_function, extent_function, user_data)) } data_representation ( std::string name , @@ -35,16 +35,16 @@ class data_representation : name_(std::move(name)), read_function_(std::move(read_function)), write_function_(std::move(write_function)), extent_function_(std::move(extent_function)) { MPI_CHECK_ERROR_CODE(MPI_Register_datarep, ( - name.c_str(), - [ ] (void* buffer, MPI_Datatype data_type, std::int32_t count , void* file_buffer, offset position, void* extra_state) + name_.c_str(), + [ ] (void* buffer, const MPI_Datatype data_type, const std::int32_t count , void* file_buffer, const offset position, void* extra_state) { return static_cast(extra_state)->read_function_ (buffer, mpi::data_type(data_type), count, file_buffer, position); }, - [ ] (void* buffer, MPI_Datatype data_type, std::int32_t count , void* file_buffer, offset position, void* extra_state) + [ ] (void* buffer, const MPI_Datatype data_type, const std::int32_t count , void* file_buffer, const offset position, void* extra_state) { return static_cast(extra_state)->write_function_(buffer, mpi::data_type(data_type), count, file_buffer, position); }, - [ ] ( MPI_Datatype data_type, aint* extent , void* extra_state) + [ ] ( const MPI_Datatype data_type, aint* extent , void* extra_state) { return static_cast(extra_state)->extent_function_( mpi::data_type(data_type), extent); }, diff --git a/include/mpi/io/file.hpp b/include/mpi/io/file.hpp index 5f52809..fa442c5 100644 --- a/include/mpi/io/file.hpp +++ b/include/mpi/io/file.hpp @@ -27,7 +27,7 @@ class file { MPI_CHECK_ERROR_CODE(MPI_File_open, (communicator.native(), filepath.c_str(), static_cast(access_mode), information.native(), &native_)) } - explicit file (MPI_File native, const bool managed = false) + explicit file (const MPI_File native, const bool managed = false) : managed_(managed), native_(native) { @@ -62,7 +62,7 @@ class file } [[nodiscard]] - access_mode access_mode () const + io::access_mode access_mode () const { io::access_mode result; MPI_CHECK_ERROR_CODE(MPI_File_get_amode, (native_, reinterpret_cast(&result))) @@ -83,7 +83,7 @@ class file return result; } [[nodiscard]] - group group () const + mpi::group group () const { mpi::group result(MPI_GROUP_NULL, true); MPI_CHECK_ERROR_CODE(MPI_File_get_group, (native_, &result.native_)) @@ -105,7 +105,7 @@ class file } [[nodiscard]] - information information () const + mpi::information information () const { mpi::information result(MPI_INFO_NULL, true); MPI_CHECK_ERROR_CODE(MPI_File_get_info, (native_, &result.native_)) diff --git a/include/mpi/tool/environment.hpp b/include/mpi/tool/environment.hpp index 297869d..e78ae59 100644 --- a/include/mpi/tool/environment.hpp +++ b/include/mpi/tool/environment.hpp @@ -31,6 +31,6 @@ class environment } protected: - thread_support provided_thread_support_; + thread_support provided_thread_support_ {}; }; } \ No newline at end of file diff --git a/include/mpi/tool/event_handle.hpp b/include/mpi/tool/event_handle.hpp index 63dd333..5a3b824 100644 --- a/include/mpi/tool/event_handle.hpp +++ b/include/mpi/tool/event_handle.hpp @@ -141,7 +141,7 @@ class event_handle } [[nodiscard]] - information information () const + mpi::information information () const { mpi::information result(MPI_INFO_NULL, true); MPI_CHECK_ERROR_CODE(MPI_T_event_handle_get_info, (native_, &result.native_)) diff --git a/include/mpi/tool/performance_variable_handle.hpp b/include/mpi/tool/performance_variable_handle.hpp index c3ee4eb..a57e6e6 100644 --- a/include/mpi/tool/performance_variable_handle.hpp +++ b/include/mpi/tool/performance_variable_handle.hpp @@ -166,7 +166,7 @@ class performance_variable_handle return object_; } [[nodiscard]] - const session& session () const + const tool::session& session () const { return session_; } diff --git a/include/mpi/tool/session.hpp b/include/mpi/tool/session.hpp index 26a3344..d83e143 100644 --- a/include/mpi/tool/session.hpp +++ b/include/mpi/tool/session.hpp @@ -13,7 +13,7 @@ class session { MPI_CHECK_ERROR_CODE(MPI_T_pvar_session_create, (&native_)) } - explicit session (MPI_T_pvar_session native, const bool managed = false) + explicit session (const MPI_T_pvar_session native, const bool managed = false) : managed_(managed), native_(native) { diff --git a/include/mpi/tool/structs/control_variable.hpp b/include/mpi/tool/structs/control_variable.hpp index aaed438..cbace1a 100644 --- a/include/mpi/tool/structs/control_variable.hpp +++ b/include/mpi/tool/structs/control_variable.hpp @@ -18,8 +18,8 @@ struct control_variable explicit control_variable (const std::int32_t index) : index(index) { auto name_size(0), description_size(0); + auto enum_type (MPI_T_ENUM_NULL ); MPI_Datatype raw_data_type(MPI_DATATYPE_NULL); - MPI_T_enum enum_type (MPI_T_ENUM_NULL ); MPI_CHECK_ERROR_CODE(MPI_T_cvar_get_info, ( index , @@ -59,17 +59,17 @@ struct control_variable control_variable& operator=(const control_variable& that) = delete ; control_variable& operator=( control_variable&& temp) = default; - std::int32_t index ; + std::int32_t index ; - std::string name ; - std::string description; + std::string name ; + std::string description ; - bind_type bind_type ; - scope scope ; - verbosity verbosity ; + mpi::tool::bind_type bind_type {}; + mpi::tool::scope scope {}; + mpi::tool::verbosity verbosity {}; - std::optional data_type ; // Abusing optional for delayed construction of a stack variable. - std::optional enumeration; + std::optional data_type ; // Abusing optional for delayed construction of a stack variable. + std::optional enumeration ; }; inline std::int32_t control_variable_index(const std::string& name) diff --git a/include/mpi/tool/structs/enumeration_item.hpp b/include/mpi/tool/structs/enumeration_item.hpp index 51815c6..4af4f7f 100644 --- a/include/mpi/tool/structs/enumeration_item.hpp +++ b/include/mpi/tool/structs/enumeration_item.hpp @@ -10,7 +10,7 @@ namespace mpi::tool { struct enumeration_item { - explicit enumeration_item (MPI_T_enum native, const std::int32_t index) : index(index) + explicit enumeration_item (const MPI_T_enum native, const std::int32_t index) : index(index) { auto name_length(0); @@ -26,8 +26,8 @@ struct enumeration_item enumeration_item& operator=(const enumeration_item& that) = default; enumeration_item& operator=( enumeration_item&& temp) = default; - std::int32_t index; - std::string name ; - std::int32_t value; + std::int32_t index ; + std::string name ; + std::int32_t value {}; }; } \ No newline at end of file diff --git a/include/mpi/tool/structs/event.hpp b/include/mpi/tool/structs/event.hpp index 4b66fad..c61f1cd 100644 --- a/include/mpi/tool/structs/event.hpp +++ b/include/mpi/tool/structs/event.hpp @@ -72,19 +72,19 @@ struct event event& operator=(const event& that) = delete ; event& operator=( event&& temp) = default; - std::int32_t index ; + std::int32_t index ; - std::string name ; - std::string description ; + std::string name ; + std::string description ; - bind_type bind_type ; - verbosity verbosity ; + mpi::tool::bind_type bind_type ; + mpi::tool::verbosity verbosity ; - std::vector data_types ; - std::vector displacements; + std::vector data_types ; + std::vector displacements; - std::optional information ; - std::optional enumeration ; + std::optional information ; + std::optional enumeration ; }; inline std::int32_t event_index(const std::string& name) diff --git a/include/mpi/tool/structs/event_source.hpp b/include/mpi/tool/structs/event_source.hpp index 6dee3e8..86742d6 100644 --- a/include/mpi/tool/structs/event_source.hpp +++ b/include/mpi/tool/structs/event_source.hpp @@ -63,16 +63,16 @@ struct event_source return result; } - std::int32_t index ; + std::int32_t index ; - std::string name ; - std::string description ; + std::string name ; + std::string description ; - bool ordered ; - count ticks_per_second; - count maximum_ticks ; + bool ordered ; + count ticks_per_second; + count maximum_ticks ; - std::optional information ; + std::optional information ; }; inline std::int32_t event_source_count() diff --git a/include/mpi/tool/structs/performance_variable.hpp b/include/mpi/tool/structs/performance_variable.hpp index 257d18f..1671d9e 100644 --- a/include/mpi/tool/structs/performance_variable.hpp +++ b/include/mpi/tool/structs/performance_variable.hpp @@ -18,8 +18,8 @@ struct performance_variable explicit performance_variable (const std::int32_t index) : index(index) { auto name_size(0), description_size(0); + auto enum_type (MPI_T_ENUM_NULL ); MPI_Datatype raw_data_type(MPI_DATATYPE_NULL); - MPI_T_enum enum_type (MPI_T_ENUM_NULL ); MPI_CHECK_ERROR_CODE(MPI_T_pvar_get_info, ( index , @@ -65,20 +65,20 @@ struct performance_variable performance_variable& operator=(const performance_variable& that) = delete ; performance_variable& operator=( performance_variable&& temp) = default; - std::int32_t index ; + std::int32_t index ; - std::string name ; - std::string description; + std::string name ; + std::string description ; - bind_type bind_type ; - performance_variable_type type ; - verbosity verbosity ; - bool read_only ; - bool continuous ; - bool atomic ; + mpi::tool::bind_type bind_type {}; + mpi::tool::performance_variable_type type {}; + mpi::tool::verbosity verbosity {}; + bool read_only {}; + bool continuous {}; + bool atomic {}; - std::optional data_type ; // Abusing optional for delayed construction of a stack variable. - std::optional enumeration; + std::optional data_type ; // Abusing optional for delayed construction of a stack variable. + std::optional enumeration ; }; inline std::int32_t performance_variable_index(const std::string& name, const performance_variable_type type) diff --git a/tests/c_interface_test.cpp b/tests/c_interface_test.cpp index 22feeea..2c057a7 100644 --- a/tests/c_interface_test.cpp +++ b/tests/c_interface_test.cpp @@ -21,9 +21,9 @@ TEST_CASE("C Interface") value = 42; if (communicator_rank == 0) - MPI_Send(&value, 1, MPI_INT, 1, 0, MPI_COMM_WORLD); + MPI_Send(&value, 1, MPI_INT32_T, 1, 0, MPI_COMM_WORLD); if (communicator_rank == 1) - MPI_Recv(&value, 1, MPI_INT, 0, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE); + MPI_Recv(&value, 1, MPI_INT32_T, 0, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE); } { @@ -31,7 +31,7 @@ TEST_CASE("C Interface") if (communicator_rank == 0) value = 42; - MPI_Bcast(&value, 1, MPI_INT, 0, MPI_COMM_WORLD); + MPI_Bcast(&value, 1, MPI_INT32_T, 0, MPI_COMM_WORLD); } { @@ -50,9 +50,9 @@ TEST_CASE("C Interface") MPI_Type_commit (&position_data_type); MPI_Datatype particle_data_type; - std::array block_lengths {1, 1}; - std::array displacements {0, sizeof (std::uint64_t)}; - std::array data_types {MPI_UINT64_T, position_data_type}; + std::array block_lengths {1, 1}; + std::array displacements {0, sizeof (std::uint64_t)}; + std::array data_types {MPI_UINT64_T, position_data_type}; MPI_Type_struct (2, block_lengths.data(), displacements.data(), data_types.data(), &particle_data_type); MPI_Type_commit (&particle_data_type); @@ -71,7 +71,7 @@ TEST_CASE("C Interface") const auto local_size (static_cast(local_values.size())); std::vector gathered_sizes(communicator_size); - MPI_Gather(&local_size, 1, MPI_INT, gathered_sizes.data(), communicator_size, MPI_INT, 0, MPI_COMM_WORLD); + MPI_Gather(&local_size, 1, MPI_INT32_T, gathered_sizes.data(), communicator_size, MPI_INT32_T, 0, MPI_COMM_WORLD); std::vector gathered_values; if (communicator_rank == 0) @@ -91,11 +91,11 @@ TEST_CASE("C Interface") std::int32_t local_value(0); MPI_Request request; - MPI_Iscatter (values.data(), 1, MPI_INT, &local_value, 1, MPI_INT, 0, MPI_COMM_WORLD, &request); + MPI_Iscatter (values.data(), 1, MPI_INT32_T, &local_value, 1, MPI_INT32_T, 0, MPI_COMM_WORLD, &request); MPI_Wait (&request, MPI_STATUS_IGNORE); MPI_Request_free(&request); local_value *= communicator_rank; - MPI_Igather (&local_value, 1, MPI_INT, values.data(), 1, MPI_INT, 0, MPI_COMM_WORLD, &request); + MPI_Igather (&local_value, 1, MPI_INT32_T, values.data(), 1, MPI_INT32_T, 0, MPI_COMM_WORLD, &request); MPI_Wait (&request, MPI_STATUS_IGNORE); MPI_Request_free(&request); } @@ -106,7 +106,7 @@ TEST_CASE("C Interface") MPI_File file; MPI_File_open (MPI_COMM_WORLD, "test.txt", MPI_MODE_CREATE | MPI_MODE_RDWR, information, &file); - MPI_File_write_all(file, &communicator_rank, 1, MPI_INT, MPI_STATUS_IGNORE); + MPI_File_write_all(file, &communicator_rank, 1, MPI_INT32_T, MPI_STATUS_IGNORE); MPI_File_close (&file); MPI_Info_free(&information); diff --git a/tests/cpp_interface_test.cpp b/tests/cpp_interface_test.cpp index 2ddb895..93c44dd 100644 --- a/tests/cpp_interface_test.cpp +++ b/tests/cpp_interface_test.cpp @@ -105,7 +105,7 @@ TEST_CASE("C++ Interface") - mpi::io::file file(mpi::world_communicator, "test.txt", mpi::io::access_mode::create | mpi::io::access_mode::read_write); + const mpi::io::file file(mpi::world_communicator, "test.txt", mpi::io::access_mode::create | mpi::io::access_mode::read_write); file.write_all(communicator_rank); // File is freed at scope exit. diff --git a/tests/mpi_test.cpp b/tests/mpi_test.cpp index 45ec32f..7123cfb 100644 --- a/tests/mpi_test.cpp +++ b/tests/mpi_test.cpp @@ -48,7 +48,7 @@ TEST_CASE("MPI Test") std::array position; }; - user_type user_object; + user_type user_object {}; if (communicator.rank() == 0) { user_object = {42, {0.0f, 1.0f, 2.0f}}; diff --git a/tests/trait_test.cpp b/tests/trait_test.cpp index 7adb254..84f5f80 100644 --- a/tests/trait_test.cpp +++ b/tests/trait_test.cpp @@ -23,23 +23,23 @@ struct aggregate { - std::int32_t x; - std::array y; + std::int32_t x {}; + std::array y {}; }; struct non_aggregate : aggregate { - std::string z; + std::string z {}; }; struct nested_aggregate { - std::int32_t x; - aggregate y; + std::int32_t x {}; + aggregate y {}; }; struct nested_non_aggregate { - std::int32_t x; - non_aggregate y; + std::int32_t x {}; + non_aggregate y {}; }; enum class enum_type { x, y, z };