Skip to content

Commit

Permalink
Merge pull request #1094 from LLNL/feature/kweiss/mpi-windows
Browse files Browse the repository at this point in the history
Fix windows build
  • Loading branch information
kennyweiss committed May 23, 2023
2 parents 60dd0c6 + 59ddbb1 commit a5b9b22
Show file tree
Hide file tree
Showing 11 changed files with 101 additions and 78 deletions.
30 changes: 13 additions & 17 deletions src/axom/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,25 +49,21 @@ install(EXPORT axom-targets
# Generate export symbols
#------------------------------------------------------------------------------
include(GenerateExportHeader)
set(_export_header ${PROJECT_BINARY_DIR}/axom_export_symbols)
generate_export_header(core
BASE_NAME axom
EXPORT_FILE_NAME ${_export_header})

if(WIN32)
foreach(_component ${AXOM_COMPONENTS_ENABLED})
# Skip header only libraries
get_property(_targetType TARGET ${_component} PROPERTY TYPE)
if(${_targetType} STREQUAL "INTERFACE_LIBRARY")
continue()
endif()
foreach(_component ${AXOM_COMPONENTS_ENABLED})
# Skip header only libraries
get_property(_targetType TARGET ${_component} PROPERTY TYPE)
if(${_targetType} STREQUAL "INTERFACE_LIBRARY")
continue()
endif()

blt_add_target_definitions(
TO ${_component}
SCOPE PRIVATE
TARGET_DEFINITIONS "axom_EXPORTS")
endforeach()
endif()
set(_export_header ${PROJECT_BINARY_DIR}/include/axom/export/${_component}.h)
generate_export_header( ${_component}
PREFIX_NAME AXOM_
EXPORT_FILE_NAME ${_export_header}
)

endforeach()

#------------------------------------------------------------------------------
# Output some information about the configuration
Expand Down
11 changes: 0 additions & 11 deletions src/axom/config.hpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,6 @@
#cmakedefine AXOM_USE_SLIC
#cmakedefine AXOM_USE_SPIN


/*
* Inline axom's macros related to export symbols, e.g. AXOM_EXPORT
*/
@INLINED_AXOM_EXPORTS@


/*
* For gradual removal of types that have been deprecated in favor of
* c++-11 types. Value can be 1 to allow with compiler warnings, 2 to
Expand All @@ -125,13 +118,9 @@

/*
* Compiler defines to configure the built-in fmt library
* Redefines AXOM_FMT_DEPRECATED to workaround nvcc compiler error
*/
#cmakedefine01 AXOM_FMT_EXCEPTIONS
#cmakedefine01 AXOM_FMT_HEADER_ONLY
#ifndef WIN32
#define AXOM_FMT_DEPRECATED AXOM_DEPRECATED
#endif

/*
* Compiler defines to configure the built-in sparsehash library
Expand Down
10 changes: 7 additions & 3 deletions src/axom/core/Types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@

#include "axom/core/Types.hpp"

// Note: For MSVC, we had to initialize the mpi_traits::type as a static constextr,
// but were not able to do so for nvcc/ompi.
// See comments in the header file for more information.

namespace axom
{
#ifdef AXOM_USE_MPI
#if defined(AXOM_USE_MPI) && !defined(_MSC_VER)

// Default initialization of mpi_traits
template <class AxomType>
Expand All @@ -26,8 +30,8 @@ const MPI_Datatype mpi_traits<std::uint32_t>::type = MPI_UINT32_T;
#ifndef AXOM_NO_INT64_T
const MPI_Datatype mpi_traits<std::int64_t>::type = MPI_INT64_T;
const MPI_Datatype mpi_traits<std::uint64_t>::type = MPI_UINT64_T;
#endif /* end AXOM_NO_INT64_T */
#endif // AXOM_NO_INT64_T

#endif /* end AXOM_USE_MPI */
#endif // defined(AXOM_USE_MPI) && !defined(_MSC_VER)

} // end namespace axom
80 changes: 55 additions & 25 deletions src/axom/core/Types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,20 @@
/*!
* \file Types.hpp
*
* \brief File exposing some common types used by axom components.
*
* \brief Exposes some common types used by axom components.
*/

#ifndef AXOM_TYPES_HPP_
#define AXOM_TYPES_HPP_

// Axom includes
#include "axom/config.hpp" // for compile time definitions
#include "axom/config.hpp"

// C/C++ includes
#include <cstdint> // for c++11 fixed with types
#include <cstdint>

#ifdef AXOM_USE_MPI
#include <mpi.h> // for MPI types
#include <mpi.h>
#endif

namespace axom
Expand Down Expand Up @@ -69,97 +68,128 @@ using IndexType = std::int32_t;

#ifdef AXOM_USE_MPI

/*!
* \brief Traits class to map Axom types to their corresponding MPI type.
*
* \note The mpi_traits are initialized in Types.cpp
* \see Types.cpp
*/
// Note: MSVC complains about uninitialized static const integer class members,
// but our nvcc/mpi combination complains about static constexpr MPI_Datatypes.
// Since it's one line per traits class, implement both ways w/ an ifdef

/// Traits class to map Axom types to their corresponding MPI type.
template <class AxomType>
struct mpi_traits
{
#ifdef _MSC_VER
static constexpr MPI_Datatype type = MPI_DATATYPE_NULL;
#else
static const MPI_Datatype type;
#endif
};

/// \name Specialization of mpi_traits
/// @{

//------------------------------------------------------------------------------
template <>
struct mpi_traits<float64>
{
#ifdef _MSC_VER
static constexpr MPI_Datatype type = MPI_DOUBLE;
#else
static const MPI_Datatype type;
#endif
};

//------------------------------------------------------------------------------
template <>
struct mpi_traits<float32>
{
#ifdef _MSC_VER
static constexpr MPI_Datatype type = MPI_FLOAT;
#else
static const MPI_Datatype type;
#endif
};

//------------------------------------------------------------------------------
template <>
struct mpi_traits<std::int8_t>
{
#ifdef _MSC_VER
static constexpr MPI_Datatype type = MPI_INT8_T;
#else
static const MPI_Datatype type;
#endif
};

//------------------------------------------------------------------------------
template <>
struct mpi_traits<std::uint8_t>
{
#ifdef _MSC_VER
static constexpr MPI_Datatype type = MPI_UINT8_T;
#else
static const MPI_Datatype type;
#endif
};

//------------------------------------------------------------------------------
template <>
struct mpi_traits<std::int16_t>
{
#ifdef _MSC_VER
static constexpr MPI_Datatype type = MPI_INT16_T;
#else
static const MPI_Datatype type;
#endif
};

//------------------------------------------------------------------------------
template <>
struct mpi_traits<std::uint16_t>
{
#ifdef _MSC_VER
static constexpr MPI_Datatype type = MPI_UINT16_T;
#else
static const MPI_Datatype type;
#endif
};

//------------------------------------------------------------------------------
template <>
struct mpi_traits<std::int32_t>
{
#ifdef _MSC_VER
static constexpr MPI_Datatype type = MPI_INT32_T;
#else
static const MPI_Datatype type;
#endif
};

//------------------------------------------------------------------------------
template <>
struct mpi_traits<std::uint32_t>
{
#ifdef _MSC_VER
static constexpr MPI_Datatype type = MPI_UINT32_T;
#else
static const MPI_Datatype type;
#endif
};

//------------------------------------------------------------------------------
#ifndef AXOM_NO_INT64_T
template <>
struct mpi_traits<std::int64_t>
{
#ifdef _MSC_VER
static constexpr MPI_Datatype type = MPI_INT64_T;
#else
static const MPI_Datatype type;
#endif
};

//------------------------------------------------------------------------------
template <>
struct mpi_traits<std::uint64_t>
{
#ifdef _MSC_VER
static constexpr MPI_Datatype type = MPI_UINT64_T;
#else
static const MPI_Datatype type;
#endif
};

#endif /* end AXOM_NO_INT64_T */
#endif // AXOM_NO_INT64_T

/// @}

#endif /* end AXOM_USE_MPI */
#endif // AXOM_USE_MPI

} // end namespace axom

Expand Down
13 changes: 7 additions & 6 deletions src/axom/mint/mesh/CurvilinearMesh.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
#define MINT_CURVILINEARMESH_HPP_

#include "axom/config.hpp"
#include "axom/mint/mesh/StructuredMesh.hpp" // base class
#include "axom/mint/config.hpp" // for compile-time definitions
#include "axom/mint/mesh/StructuredMesh.hpp"
#include "axom/mint/config.hpp"
#include "axom/export/mint.h"

namespace axom
{
Expand Down Expand Up @@ -197,10 +198,10 @@ class CurvilinearMesh : public StructuredMesh
IndexType Nj = -1,
IndexType Nk = -1);

AXOM_EXPORT CurvilinearMesh(sidre::Group* group,
IndexType Ni,
IndexType Nj = -1,
IndexType Nk = -1)
AXOM_MINT_EXPORT CurvilinearMesh(sidre::Group* group,
IndexType Ni,
IndexType Nj = -1,
IndexType Nk = -1)
: CurvilinearMesh(group, "", "", Ni, Nj, Nk)
{ }

Expand Down
13 changes: 7 additions & 6 deletions src/axom/mint/mesh/RectilinearMesh.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
#define MINT_RECTILINEARMESH_HPP_

#include "axom/config.hpp"
#include "axom/mint/mesh/StructuredMesh.hpp" // base class
#include "axom/mint/config.hpp" // for compile-time definitions
#include "axom/mint/mesh/StructuredMesh.hpp"
#include "axom/mint/config.hpp"
#include "axom/export/mint.h"

namespace axom
{
Expand Down Expand Up @@ -197,10 +198,10 @@ class RectilinearMesh : public StructuredMesh
IndexType Nj = -1,
IndexType Nk = -1);

AXOM_EXPORT RectilinearMesh(sidre::Group* group,
IndexType Ni,
IndexType Nj = -1,
IndexType Nk = -1)
AXOM_MINT_EXPORT RectilinearMesh(sidre::Group* group,
IndexType Ni,
IndexType Nj = -1,
IndexType Nk = -1)
: RectilinearMesh(group, "", "", Ni, Nj, Nk)
{ }

Expand Down
5 changes: 3 additions & 2 deletions src/axom/sidre/core/Group.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "axom/core/Macros.hpp"
#include "axom/core/Types.hpp"
#include "axom/slic.hpp"
#include "axom/export/sidre.h"

// Standard C++ headers
#include <memory>
Expand Down Expand Up @@ -1838,7 +1839,7 @@ class Group
bool m_is_list;

/// Character used to denote a path string passed to get/create calls.
AXOM_EXPORT static const char s_path_delimiter;
AXOM_SIDRE_EXPORT static const char s_path_delimiter;

/// Collection of Views
ViewCollection* m_view_coll;
Expand All @@ -1851,7 +1852,7 @@ class Group
#endif

// Collection of the valid I/O protocols for save and load.
static const std::vector<std::string> s_io_protocols;
AXOM_SIDRE_EXPORT static const std::vector<std::string> s_io_protocols;
};

} /* end namespace sidre */
Expand Down
3 changes: 2 additions & 1 deletion src/axom/sidre/spio/IOBaton.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "axom/core/Macros.hpp"
#include "axom/core/Types.hpp"
#include "axom/slic/interface/slic.hpp"
#include "axom/export/sidre.h"

namespace axom
{
Expand Down Expand Up @@ -100,7 +101,7 @@ class IOBaton

void setupReducedRanks();

static const int s_invalid_rank_id;
AXOM_SIDRE_EXPORT static const int s_invalid_rank_id;

MPI_Comm m_mpi_comm;

Expand Down
5 changes: 3 additions & 2 deletions src/axom/slam/policies/SubsettingPolicies.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "axom/core/Macros.hpp"

#include "axom/slam/NullSet.hpp"
#include "axom/export/slam.h"

#include <set>

Expand All @@ -44,7 +45,7 @@ namespace policies

struct NoSubset
{
AXOM_EXPORT static const NullSet<> s_nullSet;
AXOM_SLAM_EXPORT static const NullSet<> s_nullSet;
using ParentSetType = const Set<>;

AXOM_HOST_DEVICE NoSubset() { }
Expand All @@ -67,7 +68,7 @@ struct NoSubset

struct VirtualParentSubset
{
AXOM_EXPORT static NullSet<> s_nullSet;
AXOM_SLAM_EXPORT static NullSet<> s_nullSet;

using ParentSetType = Set<>;

Expand Down

0 comments on commit a5b9b22

Please sign in to comment.