Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
5 changes: 5 additions & 0 deletions lib/sapporo_light/sapporo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,3 +270,8 @@ int sapporo::get_ngb_list(int cluster_id,
sort(nbl, nbl + min(nblen, maxlength));
return overflow;
}

int sapporo::get_nj_max() const
{
return nj_max;
}
7 changes: 6 additions & 1 deletion lib/sapporo_light/sapporo.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ extern "C"
{
int get_device_count();
cudaError_t host_evaluate_gravity(sapporo_multi_struct);
#ifdef __cplusplus
int g6_get_nj_max_();
#endif
}

class sapporo {
Expand Down Expand Up @@ -169,7 +172,7 @@ class sapporo {

predict = false;
nj_modified = 0;

device.address_j = NULL;

device.t_j = NULL;
Expand All @@ -182,13 +185,15 @@ class sapporo {
device.acc_i = NULL;
device.vel_i = NULL;
device.jrk_i = NULL;


};
~sapporo() {};

int open(int cluster_id);
int close(int cluster_id);
int get_n_pipes();
int get_nj_max() const;
int set_ti(int cluster_id, double ti);

int set_j_particle(int cluster_id,
Expand Down
4 changes: 3 additions & 1 deletion lib/sapporo_light/sapporoG6lib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ extern "C" {
return grav.calc_lasthalf2(*cluster_id, *nj, *ni,
index, xi, vi, *eps2, h2, acc, jerk, pot, inn);
}
int g6_get_nj_max_() {
return grav.get_nj_max();
}

int g6_initialize_jp_buffer_(int* cluster_id, int* buf_size) {return 0;}
int g6_flush_jp_buffer_(int* cluster_id) {return 0;}
Expand Down Expand Up @@ -80,4 +83,3 @@ extern "C" {


}

6 changes: 6 additions & 0 deletions src/amuse_ph4/interface.cc
Original file line number Diff line number Diff line change
Expand Up @@ -936,3 +936,9 @@ int get_id_of_updated_particle(int index, int * index_of_particle, int * status)
*status = jd->UpdatedParticles[index].status;
return 0;
}

int get_nj_max(int * value)
{
*value = jd->get_nj_max();
return 0;
}
7 changes: 7 additions & 0 deletions src/amuse_ph4/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,13 @@ def recompute_timesteps():
function.result_type = 'int32'
return function

@legacy_function
def get_nj_max():
function = LegacyFunctionSpecification()
function.addParameter('nj_max', dtype='int32',
direction=function.OUT)
function.result_type = 'int32'
return function

class ph4(GravitationalDynamics,GravityFieldCode):

Expand Down
10 changes: 10 additions & 0 deletions src/amuse_ph4/src/jdata.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

#ifdef GPU
#include "grape.h"
#include "sapporo.h"
#endif

// AMUSE STOPPING CONDITIONS SUPPORT
Expand Down Expand Up @@ -1153,3 +1154,12 @@ real jdata::get_tnext()
int ndum;
return sched->get_list(NULL, ndum);
}

int jdata::get_nj_max()
{
#ifdef GPU
return g6_get_nj_max_();
#else
return std::numeric_limits<int>::max();
#endif
}
1 change: 1 addition & 0 deletions src/amuse_ph4/src/jdata.h
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ class jdata {
void spec_output(const char *s = NULL);
void to_com();
real get_tnext();
int get_nj_max();

// In gpu.cc:

Expand Down
Loading