Skip to content

Commit 171bc3b

Browse files
committed
Implement next part of equivalence of AMUSE MR1218
The first part of the code changes equivalent to AMUSE MR1218 have been added in the previous commit 13da4fe. 1) We increased the default value of "nj_max = 16384", which is way too low for many simulations. Instead, we set it to 2^18. The current default in Sapporo Light is 2^17. 2) Also, we added extra info to the error message if "address > nj_max".
1 parent 13da4fe commit 171bc3b

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

src/interfaces/sapporoG6lib.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,11 @@ extern "C" {
147147
// return grav.calc_lasthalf2(*cluster_id, *nj, *ni,
148148
// index, xi, vi, *eps2, h2, acc, jerk, pot, inn);
149149
}
150-
151-
150+
151+
int g6_get_nj_max_() {
152+
return grav.get_nj_max();
153+
}
154+
152155
void get_j_part_data(int addr, int nj,
153156
double *pos,
154157
double *vel,

src/sapporohostclass.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ int sapporo::open(std::string kernelFile, int *devices,
159159

160160
//Allocate initial memory for 16k particles per device
161161
sapdevice->allocateMemory(16384, get_n_pipes());
162-
nj_max = 16384;
162+
nj_max = 262144; //Initial max number of j-particles, can be increased if needed
163163
}//end pragma omp parallel
164164

165165
//Used to store j-memory particle counters
@@ -461,7 +461,8 @@ int sapporo::set_j_particle(int address,
461461
//Extra check, if we are still outside nj_max, we quit since particles are not
462462
//nicely send in order
463463
if (address >= nj_max) {
464-
fprintf(stderr, "Increasing nj_max was not enough! Send particles in order to the library! Exit\n");
464+
fprintf(stderr, "Increasing nj_max = %d was not enough, address = %d\n", nj_max, address);
465+
fprintf(stderr, "Send particles in order to the library! Exit\n");
465466
exit(-1);
466467
}
467468
}

0 commit comments

Comments
 (0)