From fe3be9f9bc376e463f2a626c50995fbad7d72fe3 Mon Sep 17 00:00:00 2001 From: Pieter Ghysels Date: Mon, 11 Mar 2024 14:52:39 -0700 Subject: [PATCH] Fix BPACK interface see https://github.com/pghysels/STRUMPACK/issues/116 --- src/HODLR/HODLRMatrix.cpp | 16 +++++++----- src/HODLR/HODLRMatrix.hpp | 7 ++--- src/HODLR/HODLRWrapper.cpp | 52 +++++++++++++++++++------------------- src/HODLR/HODLRWrapper.hpp | 15 ++++++----- 4 files changed, 47 insertions(+), 43 deletions(-) diff --git src/HODLR/HODLRMatrix.cpp src/HODLR/HODLRMatrix.cpp index e37c2794..533f4999 100644 --- src/HODLR/HODLRMatrix.cpp +++ src/HODLR/HODLRMatrix.cpp @@ -62,7 +62,7 @@ namespace strumpack { } template void HODLR_kernel_block_evaluation - (int* Ninter, int* Nallrows, int* Nallcols, int* Nalldat_loc, + (int* Ninter, int* Nallrows, int* Nallcols, std::int64_t* Nalldat_loc, int* allrows, int* allcols, scalar_t* alldat_loc, int* rowids, int* colids, int* pgids, int* Npmap, int* pmaps, C2Fptr KC) { @@ -96,7 +96,7 @@ namespace strumpack { } template void HODLR_block_evaluation - (int* Ninter, int* Nallrows, int* Nallcols, int* Nalldat_loc, + (int* Ninter, int* Nallrows, int* Nallcols, std::int64_t* Nalldat_loc, int* allrows, int* allcols, scalar_t* alldat_loc, int* rowids, int* colids, int* pgids, int* Npmap, int* pmaps, C2Fptr AC) { @@ -125,13 +125,14 @@ namespace strumpack { if (rank == p0) data += m*n; } ExtractionMeta e - {nullptr, *Ninter, *Nallrows, *Nallcols, *Nalldat_loc, - allrows, allcols, rowids, colids, pgids, *Npmap, pmaps}; + {nullptr, *Ninter, *Nallrows, *Nallcols, + allrows, allcols, rowids, colids, pgids, *Npmap, pmaps, + *Nalldat_loc}; temp->Aelem->operator()(I, J, B, e); } template void HODLR_block_evaluation_seq - (int* Ninter, int* Nallrows, int* Nallcols, int* Nalldat_loc, + (int* Ninter, int* Nallrows, int* Nallcols, std::int64_t* Nalldat_loc, int* allrows, int* allcols, scalar_t* alldat_loc, int* rowids, int* colids, int* pgids, int* Npmap, int* pmaps, C2Fptr f) { @@ -154,8 +155,9 @@ namespace strumpack { data += m*n; } ExtractionMeta e - {nullptr, *Ninter, *Nallrows, *Nallcols, *Nalldat_loc, - allrows, allcols, rowids, colids, pgids, *Npmap, pmaps}; + {nullptr, *Ninter, *Nallrows, *Nallcols, + allrows, allcols, rowids, colids, pgids, *Npmap, pmaps, + *Nalldat_loc}; static_cast::elem_blocks_t*> (f)->operator()(I, J, B, e); } diff --git src/HODLR/HODLRMatrix.hpp src/HODLR/HODLRMatrix.hpp index 4c62f075..c85d4003 100644 --- src/HODLR/HODLRMatrix.hpp +++ src/HODLR/HODLRMatrix.hpp @@ -53,8 +53,9 @@ namespace strumpack { struct ExtractionMeta { std::unique_ptr iwork; - int Ninter, Nallrows, Nallcols, Nalldat_loc, + int Ninter, Nallrows, Nallcols, *allrows, *allcols, *rowids, *colids, *pgids, Npmap, *pmaps; + std::int64_t Nalldat_loc; }; /** @@ -594,13 +595,13 @@ namespace strumpack { }; template void HODLR_block_evaluation - (int* Ninter, int* Nallrows, int* Nallcols, int* Nalldat_loc, + (int* Ninter, int* Nallrows, int* Nallcols, std::int64_t* Nalldat_loc, int* allrows, int* allcols, scalar_t* alldat_loc, int* rowids, int* colids, int* pgids, int* Npmap, int* pmaps, void* AC); template void HODLR_block_evaluation_seq - (int* Ninter, int* Nallrows, int* Nallcols, int* Nalldat_loc, + (int* Ninter, int* Nallrows, int* Nallcols, std::int64_t* Nalldat_loc, int* allrows, int* allcols, scalar_t* alldat_loc, int* rowids, int* colids, int* pgids, int* Npmap, int* pmaps, void* f); diff --git src/HODLR/HODLRWrapper.cpp src/HODLR/HODLRWrapper.cpp index 22e00238..750e3e62 100644 --- src/HODLR/HODLRWrapper.cpp +++ src/HODLR/HODLRWrapper.cpp @@ -247,7 +247,7 @@ namespace strumpack { F2Cptr& msh, F2Cptr& kerquant, F2Cptr& ptree, void (*C_FuncZmn)(int*, int*, float*, C2Fptr), void (*C_FuncZmnBlock) - (int* Ninter, int* Nallrows, int* Nallcols, int* Nalldat_loc, + (int* Ninter, int* Nallrows, int* Nallcols, std::int64_t* Nalldat_loc, int* allrows, int* allcols, float* alldat_loc, int* rowids, int* colids, int* pgids, int* Npmap, int* pmaps, C2Fptr elems), C2Fptr fdata) { @@ -265,7 +265,7 @@ namespace strumpack { F2Cptr& msh, F2Cptr& kerquant, F2Cptr& ptree, void (*C_FuncZmn)(int*, int*, double*, C2Fptr), void (*C_FuncZmnBlock) - (int* Ninter, int* Nallrows, int* Nallcols, int* Nalldat_loc, + (int* Ninter, int* Nallrows, int* Nallcols, std::int64_t* Nalldat_loc, int* allrows, int* allcols, double* alldat_loc, int* rowids, int* colids, int* pgids, int* Npmap, int* pmaps, C2Fptr elems), C2Fptr fdata) { @@ -279,7 +279,7 @@ namespace strumpack { F2Cptr& stats, F2Cptr& msh, F2Cptr& kerquant, F2Cptr& ptree, void (*C_FuncZmn)(int*, int*, std::complex*, C2Fptr), void (*C_FuncZmnBlock) - (int* Ninter, int* Nallrows, int* Nallcols, int* Nalldat_loc, + (int* Ninter, int* Nallrows, int* Nallcols, std::int64_t* Nalldat_loc, int* allrows, int* allcols, std::complex* alldat_loc, int* rowids, int* colids, int* pgids, int* Npmap, int* pmaps, C2Fptr elems), C2Fptr fdata) { @@ -293,7 +293,7 @@ namespace strumpack { reinterpret_cast< void(*)(int*, int*, _Complex float*, C2Fptr)>(C_FuncZmn), reinterpret_cast< - void(*)(int* Ninter, int* Nallrows, int* Nallcols, int* Nalldat_loc, + void(*)(int* Ninter, int* Nallrows, int* Nallcols, std::int64_t* Nalldat_loc, int* allrows, int* allcols, _Complex float* alldat_loc, int* rowids, int* colids, int* pgids, int* Npmap, int* pmaps, C2Fptr elems)>(C_FuncZmnBlock), fdata); @@ -304,7 +304,7 @@ namespace strumpack { F2Cptr& stats, F2Cptr& msh, F2Cptr& kerquant, F2Cptr& ptree, void (*C_FuncZmn)(int*, int*, std::complex*, C2Fptr), void (*C_FuncZmnBlock) - (int* Ninter, int* Nallrows, int* Nallcols, int* Nalldat_loc, + (int* Ninter, int* Nallrows, int* Nallcols, std::int64_t* Nalldat_loc, int* allrows, int* allcols, std::complex* alldat_loc, int* rowids, int* colids, int* pgids, int* Npmap, int* pmaps, C2Fptr elems), C2Fptr fdata) { @@ -314,7 +314,7 @@ namespace strumpack { reinterpret_cast< void(*)(int*, int*, _Complex double*, C2Fptr)>(C_FuncZmn), reinterpret_cast< - void(*)(int* Ninter, int* Nallrows, int* Nallcols, int* Nalldat_loc, + void(*)(int* Ninter, int* Nallrows, int* Nallcols, std::int64_t* Nalldat_loc, int* allrows, int* allcols, _Complex double* alldat_loc, int* rowids, int* colids, int* pgids, int* Npmap, int* pmaps, C2Fptr elems)>(C_FuncZmnBlock), fdata); @@ -326,7 +326,7 @@ namespace strumpack { F2Cptr& msh, F2Cptr& kerquant, F2Cptr& ptree, void (*C_FuncZmn)(int*, int*, float*, C2Fptr), void (*C_FuncZmnBlock) - (int* Ninter, int* Nallrows, int* Nallcols, int* Nalldat_loc, + (int* Ninter, int* Nallrows, int* Nallcols, std::int64_t* Nalldat_loc, int* allrows, int* allcols, float* alldat_loc, int* rowids, int* colids, int* pgids, int* Npmap, int* pmaps, C2Fptr elems), C2Fptr fdata) { @@ -339,7 +339,7 @@ namespace strumpack { F2Cptr& msh, F2Cptr& kerquant, F2Cptr& ptree, void (*C_FuncZmn)(int*, int*, double*, C2Fptr), void (*C_FuncZmnBlock) - (int* Ninter, int* Nallrows, int* Nallcols, int* Nalldat_loc, + (int* Ninter, int* Nallrows, int* Nallcols, std::int64_t* Nalldat_loc, int* allrows, int* allcols, double* alldat_loc, int* rowids, int* colids, int* pgids, int* Npmap, int* pmaps, C2Fptr elems), C2Fptr fdata) { @@ -352,7 +352,7 @@ namespace strumpack { F2Cptr& msh, F2Cptr& kerquant, F2Cptr& ptree, void (*C_FuncZmn)(int*, int*, std::complex*, C2Fptr), void (*C_FuncZmnBlock) - (int* Ninter, int* Nallrows, int* Nallcols, int* Nalldat_loc, + (int* Ninter, int* Nallrows, int* Nallcols, std::int64_t* Nalldat_loc, int* allrows, int* allcols, std::complex* alldat_loc, int* rowids, int* colids, int* pgids, int* Npmap, int* pmaps, C2Fptr elems), C2Fptr fdata) { @@ -361,7 +361,7 @@ namespace strumpack { reinterpret_cast< void(*)(int*, int*, _Complex float*, C2Fptr)>(C_FuncZmn), reinterpret_cast< - void(*)(int* Ninter, int* Nallrows, int* Nallcols, int* Nalldat_loc, + void(*)(int* Ninter, int* Nallrows, int* Nallcols, std::int64_t* Nalldat_loc, int* allrows, int* allcols, _Complex float* alldat_loc, int* rowids, int* colids, int* pgids, int* Npmap, int* pmaps, C2Fptr elems)>(C_FuncZmnBlock), @@ -372,7 +372,7 @@ namespace strumpack { F2Cptr& msh, F2Cptr& kerquant, F2Cptr& ptree, void (*C_FuncZmn)(int*, int*, std::complex*, C2Fptr), void (*C_FuncZmnBlock) - (int* Ninter, int* Nallrows, int* Nallcols, int* Nalldat_loc, + (int* Ninter, int* Nallrows, int* Nallcols, std::int64_t* Nalldat_loc, int* allrows, int* allcols, std::complex* alldat_loc, int* rowids, int* colids, int* pgids, int* Npmap, int* pmaps, C2Fptr elems), C2Fptr fdata) { @@ -381,7 +381,7 @@ namespace strumpack { reinterpret_cast< void(*)(int*, int*, _Complex double*, C2Fptr)>(C_FuncZmn), reinterpret_cast< - void(*)(int* Ninter, int* Nallrows, int* Nallcols, int* Nalldat_loc, + void(*)(int* Ninter, int* Nallrows, int* Nallcols, std::int64_t* Nalldat_loc, int* allrows, int* allcols, _Complex double* alldat_loc, int* rowids, int* colids, int* pgids, int* Npmap, int* pmaps, C2Fptr elems)>(C_FuncZmnBlock), @@ -520,7 +520,7 @@ namespace strumpack { template<> void LRBF_construct_element_compute (F2Cptr& lr_bf, F2Cptr& options, F2Cptr& stats, F2Cptr& msh, F2Cptr& kerquant, F2Cptr& ptree, void (*C_FuncZmnBlock) - (int* Ninter, int* Nallrows, int* Nallcols, int* Nalldat_loc, + (int* Ninter, int* Nallrows, int* Nallcols, std::int64_t* Nalldat_loc, int* allrows, int* allcols, float* alldat_loc, int* rowids, int* colids, int* pgids, int* Npmap, int* pmaps, C2Fptr elems), C2Fptr fdata) { @@ -531,7 +531,7 @@ namespace strumpack { template<> void LRBF_construct_element_compute (F2Cptr& lr_bf, F2Cptr& options, F2Cptr& stats, F2Cptr& msh, F2Cptr& kerquant, F2Cptr& ptree, void (*C_FuncZmnBlock) - (int* Ninter, int* Nallrows, int* Nallcols, int* Nalldat_loc, + (int* Ninter, int* Nallrows, int* Nallcols, std::int64_t* Nalldat_loc, int* allrows, int* allcols, double* alldat_loc, int* rowids, int* colids, int* pgids, int* Npmap, int* pmaps, C2Fptr elems), C2Fptr fdata) { @@ -542,33 +542,33 @@ namespace strumpack { template<> void LRBF_construct_element_compute> (F2Cptr& lr_bf, F2Cptr& options, F2Cptr& stats, F2Cptr& msh, F2Cptr& kerquant, F2Cptr& ptree, void (*C_FuncZmnBlock) - (int* Ninter, int* Nallrows, int* Nallcols, int* Nalldat_loc, + (int* Ninter, int* Nallrows, int* Nallcols, std::int64_t* Nalldat_loc, int* allrows, int* allcols, std::complex* alldat_loc, int* rowids, int* colids, int* pgids, int* Npmap, int* pmaps, C2Fptr elems), C2Fptr fdata) { c_c_bf_construct_element_compute (&lr_bf, &options, &stats, &msh, &kerquant, &ptree, nullptr, reinterpret_cast(C_FuncZmnBlock), fdata); } template<> void LRBF_construct_element_compute> (F2Cptr& lr_bf, F2Cptr& options, F2Cptr& stats, F2Cptr& msh, F2Cptr& kerquant, F2Cptr& ptree, void (*C_FuncZmnBlock) - (int* Ninter, int* Nallrows, int* Nallcols, int* Nalldat_loc, + (int* Ninter, int* Nallrows, int* Nallcols, std::int64_t* Nalldat_loc, int* allrows, int* allcols, std::complex* alldat_loc, int* rowids, int* colids, int* pgids, int* Npmap, int* pmaps, C2Fptr elems), C2Fptr fdata) { z_c_bf_construct_element_compute (&lr_bf, &options, &stats, &msh, &kerquant, &ptree, nullptr, reinterpret_cast(C_FuncZmnBlock), fdata); } template<> void HODLR_extract_elements (F2Cptr& ho_bf, F2Cptr& options, F2Cptr& msh, F2Cptr& stats, - F2Cptr& ptree, int Ninter, int Nallrows, int Nallcols, int Nalldat_loc, + F2Cptr& ptree, int Ninter, int Nallrows, int Nallcols, std::int64_t Nalldat_loc, int* allrows, int* allcols, float* alldat_loc, int* rowidx, int* colidx, int* pgidx, int Npmap, int* pmaps) { s_c_bpack_extractelement @@ -583,7 +583,7 @@ namespace strumpack { } template<> void HODLR_extract_elements (F2Cptr& ho_bf, F2Cptr& options, F2Cptr& msh, F2Cptr& stats, - F2Cptr& ptree, int Ninter, int Nallrows, int Nallcols, int Nalldat_loc, + F2Cptr& ptree, int Ninter, int Nallrows, int Nallcols, std::int64_t Nalldat_loc, int* allrows, int* allcols, double* alldat_loc, int* rowidx, int* colidx, int* pgidx, int Npmap, int* pmaps) { d_c_bpack_extractelement @@ -598,7 +598,7 @@ namespace strumpack { } template<> void HODLR_extract_elements> (F2Cptr& ho_bf, F2Cptr& options, F2Cptr& msh, F2Cptr& stats, - F2Cptr& ptree, int Ninter, int Nallrows, int Nallcols, int Nalldat_loc, + F2Cptr& ptree, int Ninter, int Nallrows, int Nallcols, std::int64_t Nalldat_loc, int* allrows, int* allcols, std::complex* alldat_loc, int* rowidx, int* colidx, int* pgidx, int Npmap, int* pmaps) { c_c_bpack_extractelement @@ -614,7 +614,7 @@ namespace strumpack { } template<> void HODLR_extract_elements> (F2Cptr& ho_bf, F2Cptr& options, F2Cptr& msh, F2Cptr& stats, - F2Cptr& ptree, int Ninter, int Nallrows, int Nallcols, int Nalldat_loc, + F2Cptr& ptree, int Ninter, int Nallrows, int Nallcols, std::int64_t Nalldat_loc, int* allrows, int* allcols, std::complex* alldat_loc, int* rowidx, int* colidx, int* pgidx, int Npmap, int* pmaps) { z_c_bpack_extractelement @@ -631,7 +631,7 @@ namespace strumpack { template<> void LRBF_extract_elements (F2Cptr& lr_bf, F2Cptr& options, F2Cptr& msh, F2Cptr& stats, - F2Cptr& ptree, int Ninter, int Nallrows, int Nallcols, int Nalldat_loc, + F2Cptr& ptree, int Ninter, int Nallrows, int Nallcols, std::int64_t Nalldat_loc, int* allrows, int* allcols, float* alldat_loc, int* rowidx, int* colidx, int* pgidx, int Npmap, int* pmaps) { s_c_bf_extractelement @@ -647,7 +647,7 @@ namespace strumpack { } template<> void LRBF_extract_elements (F2Cptr& lr_bf, F2Cptr& options, F2Cptr& msh, F2Cptr& stats, - F2Cptr& ptree, int Ninter, int Nallrows, int Nallcols, int Nalldat_loc, + F2Cptr& ptree, int Ninter, int Nallrows, int Nallcols, std::int64_t Nalldat_loc, int* allrows, int* allcols, double* alldat_loc, int* rowidx, int* colidx, int* pgidx, int Npmap, int* pmaps) { d_c_bf_extractelement @@ -663,7 +663,7 @@ namespace strumpack { } template<> void LRBF_extract_elements> (F2Cptr& lr_bf, F2Cptr& options, F2Cptr& msh, F2Cptr& stats, - F2Cptr& ptree, int Ninter, int Nallrows, int Nallcols, int Nalldat_loc, + F2Cptr& ptree, int Ninter, int Nallrows, int Nallcols, std::int64_t Nalldat_loc, int* allrows, int* allcols, std::complex* alldat_loc, int* rowidx, int* colidx, int* pgidx, int Npmap, int* pmaps) { c_c_bf_extractelement @@ -679,7 +679,7 @@ namespace strumpack { } template<> void LRBF_extract_elements> (F2Cptr& lr_bf, F2Cptr& options, F2Cptr& msh, F2Cptr& stats, - F2Cptr& ptree, int Ninter, int Nallrows, int Nallcols, int Nalldat_loc, + F2Cptr& ptree, int Ninter, int Nallrows, int Nallcols, std::int64_t Nalldat_loc, int* allrows, int* allcols, std::complex* alldat_loc, int* rowidx, int* colidx, int* pgidx, int Npmap, int* pmaps) { z_c_bf_extractelement diff --git src/HODLR/HODLRWrapper.hpp src/HODLR/HODLRWrapper.hpp index f94ac467..6bb3c95c 100644 --- src/HODLR/HODLRWrapper.hpp +++ src/HODLR/HODLRWrapper.hpp @@ -34,6 +34,7 @@ #include #include +#include #include "dense/DenseMatrix.hpp" #include "misc/MPIWrapper.hpp" @@ -97,7 +98,7 @@ namespace strumpack { F2Cptr& msh, F2Cptr& kerquant, F2Cptr& ptree, void (*C_FuncZmn)(int*, int*, scalar_t*, C2Fptr), void (*C_FuncZmnBlock) - (int* Ninter, int* Nallrows, int* Nallcols, int* Nalldat_loc, + (int* Ninter, int* Nallrows, int* Nallcols, std::int64_t* Nalldat_loc, int* allrows, int* allcols, scalar_t* alldat_loc, int* rowids, int* colids, int* pgids, int* Npmap, int* pmaps, C2Fptr elems), C2Fptr fdata); @@ -107,7 +108,7 @@ namespace strumpack { F2Cptr& msh, F2Cptr& kerquant, F2Cptr& ptree, void (*C_FuncZmn)(int*, int*, scalar_t*, C2Fptr), void (*C_FuncZmnBlock) - (int* Ninter, int* Nallrows, int* Nallcols, int* Nalldat_loc, + (int* Ninter, int* Nallrows, int* Nallcols, std::int64_t* Nalldat_loc, int* allrows, int* allcols, scalar_t* alldat_loc, int* rowids, int* colids, int* pgids, int* Npmap, int* pmaps, C2Fptr elems), C2Fptr K); @@ -136,21 +137,21 @@ namespace strumpack { template void LRBF_construct_element_compute (F2Cptr& lr_bf, F2Cptr& options, F2Cptr& stats, F2Cptr& msh, F2Cptr& kerquant, F2Cptr& ptree, void (*element) - (int* Ninter, int* Nallrows, int* Nallcols, int* Nalldat_loc, + (int* Ninter, int* Nallrows, int* Nallcols, std::int64_t* Nalldat_loc, int* allrows, int* allcols, scalar_t* alldat_loc, int* rowids, int* colids, int* pgids, int* Npmap, int* pmaps, C2Fptr elems), C2Fptr fdata); template void HODLR_extract_elements (F2Cptr& ho_bf, F2Cptr& options, F2Cptr& msh, F2Cptr& stats, - F2Cptr& ptree, int Ninter, int Nallrows, int Nallcols, int Nalldat_loc, - int* allrows, int* allcols, scalar_t* alldat_loc, + F2Cptr& ptree, int Ninter, int Nallrows, int Nallcols, + std::int64_t Nalldat_loc, int* allrows, int* allcols, scalar_t* alldat_loc, int* rowidx, int* colidx, int* pgidx, int Npmap, int* pmaps); template void LRBF_extract_elements (F2Cptr& lr_bf, F2Cptr& options, F2Cptr& msh, F2Cptr& stats, - F2Cptr& ptree, int Ninter, int Nallrows, int Nallcols, int Nalldat_loc, - int* allrows, int* allcols, scalar_t* alldat_loc, + F2Cptr& ptree, int Ninter, int Nallrows, int Nallcols, + std::int64_t Nalldat_loc, int* allrows, int* allcols, scalar_t* alldat_loc, int* rowidx, int* colidx, int* pgidx, int Npmap, int* pmaps); template void HODLR_deletestats(F2Cptr&);