Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix new suitesparse version and Apple Clang compiling #473

Merged
merged 23 commits into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmake/common
42 changes: 38 additions & 4 deletions include/albatross/src/cereal/suitesparse.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,11 @@ inline void save(Archive &ar, cholmod_common const &cc,
// workspace, so we don't even do anything special when we
// deserialize.
ar(CEREAL_NVP(cc.itype));

#if CHOLMOD_VERSION < CHOLMOD_VER_CODE(5, 0)
ar(CEREAL_NVP(cc.dtype));
#endif

ar(CEREAL_NVP(cc.no_workspace_reallocate));
ar(CEREAL_NVP(cc.status));
ar(CEREAL_NVP(cc.fl));
Expand Down Expand Up @@ -177,8 +181,18 @@ inline void save(Archive &ar, cholmod_common const &cc,
ar(CEREAL_NVP(cc.SPQR_flopcount_bound));
ar(CEREAL_NVP(cc.SPQR_tol_used));
ar(CEREAL_NVP(cc.SPQR_norm_E_fro));
static_assert(sizeof(cc.SPQR_istat) == 10 * sizeof(SuiteSparse_long),
"cholmod_common.SPQR_istat expected to have 10 elements.");

// The number of elements was size 10 in CHOLMOD v4.2; reduced to 8 in CHOLMOD
// v5:
#if CHOLMOD_VERSION < CHOLMOD_VER_CODE(5, 0)
constexpr size_t cNumSPQRElements = 10;
#else
constexpr size_t cNumSPQRElements = 8;
#endif
static_assert(
sizeof(cc.SPQR_istat) == cNumSPQRElements * sizeof(SuiteSparse_long),
"cholmod_common.SPQR_istat expected to have certain number of elements.");

ar(::cereal::make_nvp("cc.SPQR_istat0", cc.SPQR_istat[0]));
ar(::cereal::make_nvp("cc.SPQR_istat1", cc.SPQR_istat[1]));
ar(::cereal::make_nvp("cc.SPQR_istat2", cc.SPQR_istat[2]));
Expand All @@ -187,8 +201,11 @@ inline void save(Archive &ar, cholmod_common const &cc,
ar(::cereal::make_nvp("cc.SPQR_istat5", cc.SPQR_istat[5]));
ar(::cereal::make_nvp("cc.SPQR_istat6", cc.SPQR_istat[6]));
ar(::cereal::make_nvp("cc.SPQR_istat7", cc.SPQR_istat[7]));

#if CHOLMOD_VERSION < CHOLMOD_VER_CODE(5, 0)
ar(::cereal::make_nvp("cc.SPQR_istat8", cc.SPQR_istat[8]));
ar(::cereal::make_nvp("cc.SPQR_istat9", cc.SPQR_istat[9]));
#endif

// Completely ignore all the GPU stuff.
#ifdef GPU_BLAS
Expand Down Expand Up @@ -261,7 +278,11 @@ inline void load(Archive &ar, cholmod_common &cc,
ar(CEREAL_NVP(cc.mark));
ALBATROSS_ASSERT(cholmod_l_free_work(&cc) == 1);
ar(CEREAL_NVP(cc.itype));

#if CHOLMOD_VERSION < CHOLMOD_VER_CODE(5, 0)
ar(CEREAL_NVP(cc.dtype));
#endif

ar(CEREAL_NVP(cc.no_workspace_reallocate));
ar(CEREAL_NVP(cc.status));
ar(CEREAL_NVP(cc.fl));
Expand Down Expand Up @@ -289,8 +310,18 @@ inline void load(Archive &ar, cholmod_common &cc,
ar(CEREAL_NVP(cc.SPQR_flopcount_bound));
ar(CEREAL_NVP(cc.SPQR_tol_used));
ar(CEREAL_NVP(cc.SPQR_norm_E_fro));
static_assert(sizeof(cc.SPQR_istat) == 10 * sizeof(SuiteSparse_long),
"cholmod_common.SPQR_istat expected to have 10 elements.");

// The number of elements was size 10 in CHOLMOD v4.2; reduced to 8 in CHOLMOD
// v5:
#if CHOLMOD_VERSION < CHOLMOD_VER_CODE(5, 0)
constexpr size_t cNumSPQRElements = 10;
#else
constexpr size_t cNumSPQRElements = 8;
#endif

static_assert(
sizeof(cc.SPQR_istat) == cNumSPQRElements * sizeof(SuiteSparse_long),
"cholmod_common.SPQR_istat expected to have certain number of elements.");
ar(::cereal::make_nvp("cc.SPQR_istat0", cc.SPQR_istat[0]));
ar(::cereal::make_nvp("cc.SPQR_istat1", cc.SPQR_istat[1]));
ar(::cereal::make_nvp("cc.SPQR_istat2", cc.SPQR_istat[2]));
Expand All @@ -299,8 +330,11 @@ inline void load(Archive &ar, cholmod_common &cc,
ar(::cereal::make_nvp("cc.SPQR_istat5", cc.SPQR_istat[5]));
ar(::cereal::make_nvp("cc.SPQR_istat6", cc.SPQR_istat[6]));
ar(::cereal::make_nvp("cc.SPQR_istat7", cc.SPQR_istat[7]));

#if CHOLMOD_VERSION < CHOLMOD_VER_CODE(5, 0)
ar(::cereal::make_nvp("cc.SPQR_istat8", cc.SPQR_istat[8]));
ar(::cereal::make_nvp("cc.SPQR_istat9", cc.SPQR_istat[9]));
#endif

// Completely ignore all the GPU stuff.
#ifdef GPU_BLAS
Expand Down
2 changes: 1 addition & 1 deletion third_party/eigen
Loading