Skip to content

Commit

Permalink
ctest -R netpar passes. MPI_Comm not available from cvodeobj.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
nrnhines committed May 5, 2023
1 parent 9a38810 commit e0b3ef1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/nrncvode/cvodeobj.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ extern void nrn2ncs_netcons();
#endif // USENCS
#if PARANEURON
extern "C" {
extern N_Vector N_VNew_Parallel(int comm, long int local_length, long int global_length);
extern N_Vector nrnwrap_N_VNew_Parallel(int comm, long int local_length, long int global_length);
extern N_Vector N_VNew_NrnParallelLD(int comm, long int local_length, long int global_length);
} // extern "C"
#endif
Expand Down Expand Up @@ -824,10 +824,11 @@ void Cvode::set_init_flag() {
N_Vector Cvode::nvnew(long int n) {
#if PARANEURON
if (use_partrans_) {
// the comm arg is ignored and replaced by MPI_Comm nrnmpi_comm
if (net_cvode_instance->use_long_double_) {
return N_VNew_NrnParallelLD(0, n, global_neq_);
} else {
return N_VNew_Parallel(0, n, global_neq_);
return nrnwrap_N_VNew_Parallel(0, n, global_neq_);
}
}
#endif
Expand Down
12 changes: 12 additions & 0 deletions src/nrniv/nvector_nrnparallel_ld.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,18 @@ static void VScaleBy_NrnParallelLD(realtype a, N_Vector x);
* -----------------------------------------------------------------
*/

// wrapped because nrnmpi_comm not available from cvodeobj.cpp
// This needs to be modified to work for NRNMPI_DYNAMICLOAD
extern "C" {
extern N_Vector N_VNew_Parallel(MPI_Comm comm,
sunindextype local_length,
sunindextype global_length);

N_Vector nrnwrap_N_VNew_Parallel(int ignore, long int local_length, long int global_length) {
return N_VNew_Parallel(nrnmpi_comm, sunindextype(local_length), sunindextype(global_length));
}
}

/* ----------------------------------------------------------------
* Function to create a new parallel vector with empty data array
*/
Expand Down

0 comments on commit e0b3ef1

Please sign in to comment.