Skip to content

Commit e4876dd

Browse files
ffast-math
1 parent 5242e87 commit e4876dd

File tree

5 files changed

+10
-14
lines changed

5 files changed

+10
-14
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ MODULE := vegasglow
2626

2727
# === Compiler & flags ===
2828
CXX ?= g++
29-
CXXFLAGS := -std=c++20 -O3 -march=native -flto -Iinclude -Iexternal -g3 -w -DXTENSOR_USE_XSIMD=ON
29+
CXXFLAGS := -std=c++20 -O3 -march=native -flto -Iinclude -Iexternal -g3 -w -ffast-math# -DXTENSOR_USE_XSIMD=ON
3030
LDFLAGS := -lz
3131
AR := ar
3232
ARFLAGS := rcs

pybind/mcmc.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,8 @@ void MultiBandModel::build_system(Params const& param, Array const& t_eval, Obse
200200

201201
auto shock = generate_fwd_shock(coord, medium, jet, eps_e, eps_B, config.rtol);
202202

203-
obs.observe_at(t_eval, coord, shock, lumi_dist, z);
204-
// obs.observe(coord, shock, lumi_dist, z);
203+
// obs.observe_at(t_eval, coord, shock, lumi_dist, z);
204+
obs.observe(coord, shock, lumi_dist, z);
205205

206206
electrons = generate_syn_electrons(shock, p, xi);
207207

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def find_sources():
1010
sources.append(os.path.join(root, fn))
1111
return sources
1212

13-
extra_compile_args = ["-std=c++20", "-O3", "-march=native", "-flto", "-w", "-DNDEBUG", "-fPIC"]
13+
extra_compile_args = ["-std=c++20", "-O3", "-march=native", "-flto", "-w", "-DNDEBUG", "-fPIC", "-ffast-math"]
1414
extra_link_args = ["-lz"]
1515
if platform.system() == "Darwin":
1616
extra_link_args += ["-undefined", "dynamic_lookup"]

src/core/observer.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,9 @@ void Observer::calc_emission_surface(Coord const& coord, Shock const& shock) {
6565
size_t i_eff = i * jet_3d;
6666
for (size_t j = 0; j < theta_grid; ++j) {
6767
for (size_t k = 0; k < t_grid; ++k) {
68-
if (shock.required(i_eff, j, k) == 0) {
69-
continue;
70-
}
71-
68+
// if (shock.required(i_eff, j, k) == 0) {
69+
// continue;
70+
// } // maybe remove this inner branch harm to vectorization
7271
Real dOmega = std::fabs(dcos(i_eff, j, k) * dphi(i));
7372
Real r = shock.r(i_eff, j, k);
7473
lg2_surface(i, j, k) = std::log2(dOmega * r * r) + 3 * lg2_doppler(i, j, k);
@@ -188,10 +187,7 @@ void Observer::observe(Coord const& coord, Shock const& shock, Real luminosity_d
188187

189188
void Observer::observe_at(Array const& t_obs, Coord const& coord, Shock& shock, Real luminosity_dist, Real redshift) {
190189
build_time_grid(coord, shock, luminosity_dist, redshift);
191-
192190
xt::view(shock.required, xt::all(), xt::all(), xt::all()) = 0;
193-
194191
update_required(shock.required, t_obs);
195-
196192
calc_emission_surface(coord, shock);
197193
}

tests/benchmark/benchmark.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ void tests(size_t r_num, size_t theta_num, size_t phi_num, Real n_ism, Real eps_
2323

2424
Observer obs;
2525

26-
obs.observe_at(t_obs, coord, f_shock, lumi_dist, z);
26+
// obs.observe_at(t_obs, coord, f_shock, lumi_dist, z);
2727

28-
// obs.observe(coord, f_shock, lumi_dist, z);
28+
obs.observe(coord, f_shock, lumi_dist, z);
2929

3030
auto syn_e = generate_syn_electrons(f_shock, p);
3131

@@ -63,7 +63,7 @@ int main() {
6363
tests(r, r, r, n_ism, eps_e, eps_B, p, 1e52 * unit::erg, Gamma0, 0.1, 0.3, true);
6464
}
6565

66-
size_t benchmark_resolu[] = {24, 25, 28};
66+
size_t benchmark_resolu[] = {24, 32};
6767

6868
for (auto r : benchmark_resolu) {
6969
std::ofstream file("benchmark" + std::to_string(r) + "-" + std::to_string(r) + "-" + std::to_string(r) +

0 commit comments

Comments
 (0)