Removed init. of pot_act_ext from main loop;
zero filling of pot_act_ext now only if external potential active; improved warning on minimum timestep; changed CUDAHOME to CUDA_HOME
This commit is contained in:
parent
0a2344563d
commit
064eb4e3c5
2 changed files with 18 additions and 19 deletions
20
Makefile
20
Makefile
|
|
@ -1,18 +1,18 @@
|
||||||
CUDAHOME ?= /usr/local/cuda
|
CUDA_HOME ?= /usr/local/cuda
|
||||||
CPPFLAGS += -DETICS
|
CPPFLAGS += -DETICS
|
||||||
OPTIMIZATION ?= 3
|
OPTIMIZATION ?= 3
|
||||||
|
|
||||||
CUDAINC = -I$(CUDAHOME)/include -I$(CUDAHOME)/samples/common/inc/
|
CUDAINC = -I$(CUDA_HOME)/include -I$(CUDA_HOME)/samples/common/inc/
|
||||||
CUDALIB = -L$(CUDAHOME)/lib64 -lcudart -lcudadevrt -lcuda
|
CUDALIB = -L$(CUDA_HOME)/lib64 -lcudart -lcudadevrt -lcuda
|
||||||
|
|
||||||
default: grapite
|
default: grapite
|
||||||
grapite: GRAPEHOME = ../grapite
|
grapite: GRAPE_HOME = ../grapite
|
||||||
grapite: GRAPELIB = -L$(GRAPEHOME) -lgrapite
|
grapite: GRAPELIB = -L$(GRAPE_HOME) -lgrapite
|
||||||
yebisu: GRAPEHOME = ../yebisu
|
yebisu: GRAPE_HOME = ../yebisu
|
||||||
yebisu: GRAPELIB = -L$(GRAPEHOME) -lyebisug6
|
yebisu: GRAPELIB = -L$(GRAPE_HOME) -lyebisug6
|
||||||
sapporo: GRAPEHOME = ../sapporo2/lib
|
sapporo: GRAPE_HOME = ../sapporo2/lib
|
||||||
sapporo: GRAPELIB = -L$(GRAPEHOME) -lsapporo
|
sapporo: GRAPELIB = -L$(GRAPE_HOME) -lsapporo
|
||||||
GRAPEINC = -I$(GRAPEHOME)
|
GRAPEINC = -I$(GRAPE_HOME)
|
||||||
|
|
||||||
CXXFLAGS += -std=c++11 -O$(OPTIMIZATION)
|
CXXFLAGS += -std=c++11 -O$(OPTIMIZATION)
|
||||||
INC = $(GRAPEINC) $(CUDAINC)
|
INC = $(GRAPEINC) $(CUDAINC)
|
||||||
|
|
|
||||||
17
phigrape.cpp
17
phigrape.cpp
|
|
@ -71,12 +71,7 @@ public:
|
||||||
void add_component(External_gravity &component)
|
void add_component(External_gravity &component)
|
||||||
{
|
{
|
||||||
components.push_back(&component);
|
components.push_back(&component);
|
||||||
}
|
if (component.is_active) any_active = true;
|
||||||
bool any_active()
|
|
||||||
{
|
|
||||||
for (auto component : components)
|
|
||||||
if (component->is_active) return true;
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
void operator()(int n, const std::vector<double3> &x, const std::vector<double3> &v, std::vector<double> &pot, std::vector<double3> &acc, std::vector<double3> &jrk)
|
void operator()(int n, const std::vector<double3> &x, const std::vector<double3> &v, std::vector<double> &pot, std::vector<double3> &acc, std::vector<double3> &jrk)
|
||||||
{
|
{
|
||||||
|
|
@ -92,6 +87,7 @@ public:
|
||||||
}
|
}
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
|
bool any_active = false;
|
||||||
private:
|
private:
|
||||||
std::vector<External_gravity*> components;
|
std::vector<External_gravity*> components;
|
||||||
};
|
};
|
||||||
|
|
@ -497,6 +493,7 @@ int main(int argc, char *argv[])
|
||||||
std::vector<int> ind_act(N);
|
std::vector<int> ind_act(N);
|
||||||
std::vector<double3> x_act_new(N), v_act_new(N), a_act_new(N), adot_act_new(N);
|
std::vector<double3> x_act_new(N), v_act_new(N), a_act_new(N), adot_act_new(N);
|
||||||
std::vector<double> t(N, time_cur), pot_act_new(N);
|
std::vector<double> t(N, time_cur), pot_act_new(N);
|
||||||
|
std::vector<double> pot_act_ext(N, 0.);
|
||||||
|
|
||||||
// Functors for the main integration loop
|
// Functors for the main integration loop
|
||||||
Active_search active_search(myRank, n_proc, n_loc, N, grapite_active_search_flag);
|
Active_search active_search(myRank, n_proc, n_loc, N, grapite_active_search_flag);
|
||||||
|
|
@ -555,8 +552,10 @@ int main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Calculate gravity on active particles due to external forces */
|
/* Calculate gravity on active particles due to external forces */
|
||||||
std::vector<double> pot_act_ext(N, 0.);
|
if (calc_ext_grav.any_active) {
|
||||||
calc_ext_grav(n_act, x_act_new, v_act_new, pot_act_ext, a_act_new, adot_act_new);
|
std::fill_n(begin(pot_act_ext), n_act, 0);
|
||||||
|
calc_ext_grav(n_act, x_act_new, v_act_new, pot_act_ext, a_act_new, adot_act_new);
|
||||||
|
}
|
||||||
|
|
||||||
/* correct the active particles positions etc... on all the nodes */
|
/* correct the active particles positions etc... on all the nodes */
|
||||||
double min_dt = dt_max;
|
double min_dt = dt_max;
|
||||||
|
|
@ -589,7 +588,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
if (config.dt_min_warning && (myRank == 0)) {
|
if (config.dt_min_warning && (myRank == 0)) {
|
||||||
if (dt_tmp == dt_min) {
|
if (dt_tmp == dt_min) {
|
||||||
printf("!!! Warning1: dt_act = dt_min = %.6E \t ind_act = %07d \n", dt_tmp, ind_act[i]);
|
printf("!!! Warning1: dt_act = dt_min = %.6E \t ind_act = %07d time_cur=%.16E\n", dt_tmp, ind_act[i], time_cur);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue