Skip to content

Commit a3088af

Browse files
authored
Release v0.5.0 (#1442)
* Update goldfinger ndebug environment * Use ordered map for enhanced reproducibility * Add release notes * Improve slot diagnostic examples * Update documentation * Add some documentation to msc * Remove deprecated code
1 parent 8248052 commit a3088af

19 files changed

+413
-41
lines changed

doc/appendix/release-history.rst

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Release History
1616
:maxdepth: 2
1717
:caption: Appendices
1818

19+
release-history/v0.5.rst
1920
release-history/v0.4.rst
2021
release-history/v0.3.rst
2122
release-history/v0.2.rst

doc/appendix/release-history/v0.5.rst

+339
Large diffs are not rendered by default.

scripts/cmake-presets/goldfinger.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -129,14 +129,14 @@
129129
"CELERITAS_USE_ROOT": {"type": "BOOL", "value": "OFF"},
130130
"CELERITAS_USE_VecGeom": {"type": "BOOL", "value": "ON"},
131131
"CMAKE_CXX_COMPILER_LAUNCHER": "/opt/homebrew/bin/ccache",
132-
"Geant4_DIR": "/Users/seth/Code/geant4-dev/build",
132+
"Geant4_DIR": "/Users/seth/Code/geant4-dev/install/lib/cmake/Geant4",
133133
"CELERITAS_BUILD_DEMOS": {"type": "BOOL", "value": "OFF"},
134134
"CELERITAS_BUILD_TESTS": {"type": "BOOL", "value": "OFF"},
135135
"CELERITAS_UNITS": "CLHEP"
136136
},
137137
"environment": {
138138
"PATH": "/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/Library/Apple/usr/bin",
139-
"CMAKE_PREFIX_PATH": "/opt/spack/opt/spack/sonoma/googletest/1.14.0/wjvv2w2:/opt/spack/opt/spack/sonoma/vecgeom/1.2.8/t4hnxz2:/opt/spack/opt/spack/sonoma/xerces-c/3.2.4/umj37ov:/opt/spack/opt/spack/sonoma/curl/8.4.0/x4tl4tu:/opt/spack/opt/spack/sonoma/zlib-ng/2.1.3/udbedjf:/opt/spack/opt/spack/sonoma/nghttp2/1.52.0/dzvtf5b:/opt/spack/opt/spack/sonoma/veccore/0.8.1/ye5hcpf:/opt/spack/opt/spack/sonoma/libpng/1.6.39/wl4oyhp:/opt/spack/opt/spack/sonoma/zlib-ng/2.1.3/udbedjf"
139+
"CMAKE_PREFIX_PATH": "/opt/spack/opt/spack/sequoia/libpng/1.6.39/3g6j5kh:/opt/spack/opt/spack/sequoia/zlib-ng/2.2.1/6s4rdcx:/opt/spack/opt/spack/sequoia/vecgeom/1.2.8/own7ofl:/opt/spack/opt/spack/sequoia/xerces-c/3.2.5/3zdtn2m:/opt/spack/opt/spack/sequoia/veccore/0.8.1/x34t746:/opt/spack/opt/spack/sequoia/nlohmann-json/3.11.3/fpe7aef:/opt/spack/opt/spack/sequoia/hepmc3/3.3.0/rrfyfcx:/opt/spack/opt/spack/sequoia/googletest/1.14.0/cwduo4b"
140140
}
141141
}
142142
],

src/celeritas/Units.hh

+2
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,8 @@ CELER_ICRT gauss = real_type(1e-4) * tesla;
163163

164164
//!@{
165165
//! \name Other common units
166+
CELER_ICRT micrometer = real_type(1e-4) * centimeter;
167+
CELER_ICRT nanometer = real_type(1e-7) * centimeter;
166168
CELER_ICRT femtometer = real_type(1e-13) * centimeter;
167169
CELER_ICRT barn = real_type(1e-24) * centimeter * centimeter;
168170
//!@}

src/celeritas/em/data/UrbanMscData.hh

+4-4
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ struct UrbanMscParameters
3939
Energy low_energy_limit{0};
4040
Energy high_energy_limit{0};
4141

42-
//! A scale factor for the range
43-
static CELER_CONSTEXPR_FUNCTION real_type dtrl() { return 5e-2; }
42+
//! Fraction of the range below which a step is assumed constant xs
43+
static CELER_CONSTEXPR_FUNCTION real_type dtrl() { return 0.05; }
4444

4545
//! The minimum value of the true path length limit: 0.01 nm
4646
static CELER_CONSTEXPR_FUNCTION real_type limit_min_fix()
4747
{
48-
return 1e-9 * units::centimeter;
48+
return real_type(0.01) * units::nanometer;
4949
}
5050

5151
//! Minimum true path when not calculated in the step limiting
@@ -57,7 +57,7 @@ struct UrbanMscParameters
5757
//! For steps below this value, true = geometrical (no MSC to be applied)
5858
static CELER_CONSTEXPR_FUNCTION real_type min_step()
5959
{
60-
return 100 * limit_min_fix();
60+
return 1 * units::nanometer;
6161
}
6262

6363
//! Below this endpoint energy, don't sample scattering: 1 eV

src/celeritas/em/msc/detail/UrbanMscSafetyStepLimit.hh

+2
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,8 @@ CELER_FUNCTION real_type UrbanMscSafetyStepLimit::operator()(Engine& rng)
209209
//---------------------------------------------------------------------------//
210210
/*!
211211
* Calculate the minimum of the true path length limit.
212+
*
213+
* See \c G4UrbanMscModel::ComputeTlimitmin .
212214
*/
213215
CELER_FUNCTION real_type UrbanMscSafetyStepLimit::calc_limit_min(
214216
UrbanMscMaterialData const& msc, Energy const inc_energy) const

src/celeritas/em/msc/detail/UrbanMscScatter.hh

+1-1
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ UrbanMscScatter::UrbanMscScatter(UrbanMscRef const& shared,
264264
// many of the class member data
265265
theta0_ = this->compute_theta0();
266266

267-
if (theta0_ < 1e-8)
267+
if (theta0_ < real_type(1e-8))
268268
{
269269
// Arbitrarily (?) small angle change (theta_0^2 < 1e-16):
270270
// skip sampling angular distribution if width of direction

src/celeritas/ext/GeantImporter.cc

+1-2
Original file line numberDiff line numberDiff line change
@@ -803,8 +803,7 @@ auto import_processes(GeantImporter::DataSelection::Flags process_flags,
803803

804804
static celeritas::TypeDemangler<G4VProcess> const demangle_process;
805805
std::unordered_map<G4VProcess const*, G4ParticleDefinition const*> visited;
806-
detail::GeantProcessImporter import_process(
807-
detail::TableSelection::minimal, materials, elements);
806+
detail::GeantProcessImporter import_process(materials, elements);
808807
detail::GeantOpticalModelImporter import_optical_model(materials);
809808

810809
auto append_process = [&](G4ParticleDefinition const& particle,

src/celeritas/ext/detail/GeantProcessImporter.cc

-1
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,6 @@ bool all_are_assigned(std::vector<T> const& arr)
246246
* Construct with a selected list of tables.
247247
*/
248248
GeantProcessImporter::GeantProcessImporter(
249-
TableSelection,
250249
std::vector<ImportPhysMaterial> const& materials,
251250
std::vector<ImportElement> const& elements)
252251
: materials_(materials), elements_(elements)

src/celeritas/ext/detail/GeantProcessImporter.hh

+2-11
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,6 @@ namespace celeritas
3232
{
3333
namespace detail
3434
{
35-
//---------------------------------------------------------------------------//
36-
// DEPRECATED: remove in v0.5
37-
enum class TableSelection
38-
{
39-
minimal, //!< Store only lambda, dedx, and range
40-
all
41-
};
42-
4335
//---------------------------------------------------------------------------//
4436
/*!
4537
* Simplify the convoluted mechanism to store Geant4 process, model, and XS
@@ -54,7 +46,7 @@ enum class TableSelection
5446
*
5547
* \code
5648
* std::vector<ImportProcess> processes;
57-
* GeantProcessImporter import(TableSelection::all, materials, elements);
49+
* GeantProcessImporter import(materials, elements);
5850
*
5951
* G4ParticleTable::G4PTblDicIterator& particle_iterator
6052
* = *(G4ParticleTable::GetParticleTable()->GetIterator());
@@ -82,8 +74,7 @@ class GeantProcessImporter
8274
{
8375
public:
8476
// Construct with selected list of tables
85-
GeantProcessImporter(TableSelection which_tables,
86-
std::vector<ImportPhysMaterial> const& materials,
77+
GeantProcessImporter(std::vector<ImportPhysMaterial> const& materials,
8778
std::vector<ImportElement> const& elements);
8879

8980
// Import processes

src/celeritas/io/ImportParameters.hh

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//---------------------------------------------------------------------------//
88
#pragma once
99

10-
#include <unordered_map>
10+
#include <map>
1111

1212
#include "celeritas/Constants.hh"
1313
#include "celeritas/Types.hh"
@@ -107,7 +107,7 @@ struct ImportTransParameters
107107
//!@{
108108
//! \name Type aliases
109109
using PDGInt = int;
110-
using ImportLoopingMap = std::unordered_map<PDGInt, ImportLoopingThreshold>;
110+
using ImportLoopingMap = std::map<PDGInt, ImportLoopingThreshold>;
111111
//!@}
112112

113113
//! Thresholds for killing looping tracks

src/celeritas/track/ExtendFromSecondariesAction.cc

+7
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,13 @@ void ExtendFromSecondariesAction::step_impl(CoreParams const& core_params,
7878

7979
/*! \todo If we don't have space for all the secondaries, we will need to
8080
* buffer the current track initializers to create room.
81+
*
82+
* This isn't trivial because we will need to:
83+
* - Allocate a new buffer (probably do something like 2x, rounding up to
84+
* nearest power of 2)?
85+
* - Update the collection references for track sim
86+
* - Update the *copies* of that reference (?) like in track state
87+
* - Copy to device to update the on-device refrences (state.ptr)
8188
*/
8289
counters.num_initializers += counters.num_secondaries;
8390
CELER_VALIDATE(counters.num_initializers <= init.initializers.size(),
4.42 KB
Binary file not shown.

test/celeritas/data/lar-sphere.root

3.67 KB
Binary file not shown.

test/celeritas/data/simple-cms.root

2.58 KB
Binary file not shown.

test/celeritas/ext/RootJsonDumper.test.cc

+8-8
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ TEST_F(RootJsonDumperTest, all)
202202
"name" : "G4_STAINLESS-STEEL",
203203
"state" : 1,
204204
"temperature" : 293.15,
205-
"number_density" : 86993489258991530803200,
205+
"number_density" : 86993489258991547580416,
206206
"elements" : [{
207207
"_typename" : "celeritas::ImportMatElemComponent",
208208
"element_id" : 0,
@@ -263,8 +263,8 @@ TEST_F(RootJsonDumperTest, all)
263263
"range" : 0.1
264264
}}]
265265
}],
266+
"optical_models" : [],
266267
"optical_materials" : [],
267-
"optical_models": [],
268268
"regions" : [{
269269
"_typename" : "celeritas::ImportRegion",
270270
"name" : "DefaultRegionForTheWorld",
@@ -387,7 +387,7 @@ TEST_F(RootJsonDumperTest, all)
387387
"_typename" : "celeritas::ImportPhysicsVector",
388388
"vector_type" : 2,
389389
"x" : [1e-4, 100],
390-
"y" : [0.0919755519795958, 128.588033594672]
390+
"y" : [0.0919755519795959, 128.588033594672]
391391
}]
392392
}
393393
}, {
@@ -441,23 +441,23 @@ TEST_F(RootJsonDumperTest, all)
441441
},
442442
"trans_params" : {
443443
"_typename" : "celeritas::ImportTransParameters",
444-
"looping" : [{"$pair" : "pair<int,celeritas::ImportLoopingThreshold>", "first" : -11, "second" : {
444+
"looping" : [{"$pair" : "pair<int,celeritas::ImportLoopingThreshold>", "first" : -13, "second" : {
445445
"_typename" : "celeritas::ImportLoopingThreshold",
446446
"threshold_trials" : 10,
447447
"important_energy" : 250
448-
}}, {"$pair" : "pair<int,celeritas::ImportLoopingThreshold>", "first" : 11, "second" : {
448+
}}, {"$pair" : "pair<int,celeritas::ImportLoopingThreshold>", "first" : -11, "second" : {
449449
"_typename" : "celeritas::ImportLoopingThreshold",
450450
"threshold_trials" : 10,
451451
"important_energy" : 250
452-
}}, {"$pair" : "pair<int,celeritas::ImportLoopingThreshold>", "first" : 22, "second" : {
452+
}}, {"$pair" : "pair<int,celeritas::ImportLoopingThreshold>", "first" : 11, "second" : {
453453
"_typename" : "celeritas::ImportLoopingThreshold",
454454
"threshold_trials" : 10,
455455
"important_energy" : 250
456-
}}, {"$pair" : "pair<int,celeritas::ImportLoopingThreshold>", "first" : -13, "second" : {
456+
}}, {"$pair" : "pair<int,celeritas::ImportLoopingThreshold>", "first" : 13, "second" : {
457457
"_typename" : "celeritas::ImportLoopingThreshold",
458458
"threshold_trials" : 10,
459459
"important_energy" : 250
460-
}}, {"$pair" : "pair<int,celeritas::ImportLoopingThreshold>", "first" : 13, "second" : {
460+
}}, {"$pair" : "pair<int,celeritas::ImportLoopingThreshold>", "first" : 22, "second" : {
461461
"_typename" : "celeritas::ImportLoopingThreshold",
462462
"threshold_trials" : 10,
463463
"important_energy" : 250

test/celeritas/user/SimpleLoopTestBase.cc

+13-4
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,17 @@ namespace celeritas
1515
{
1616
namespace test
1717
{
18+
//---------------------------------------------------------------------------//
19+
/*!
20+
* Number primaries given number track slots.
21+
*
22+
* Default is passthrough.
23+
*/
24+
size_type SimpleLoopTestBase::initial_occupancy(size_type num_tracks) const
25+
{
26+
return num_tracks;
27+
}
28+
1829
//---------------------------------------------------------------------------//
1930
/*!
2031
* Run a stepping loop with the core data.
@@ -30,11 +41,9 @@ void SimpleLoopTestBase::run_impl(size_type num_tracks, size_type num_steps)
3041
Stepper<M> step(step_inp);
3142
LogContextException log_context{this->output_reg().get()};
3243

33-
double primary_frac = this->initial_occupancy();
34-
CELER_VALIDATE(primary_frac >= 0, << "invalid initial occupancy");
44+
size_type num_primaries = this->initial_occupancy(num_tracks);
3545
// Initial step
36-
auto primaries = this->make_primaries(
37-
static_cast<size_type>(num_tracks * primary_frac));
46+
auto primaries = this->make_primaries(num_primaries);
3847
StepperResult count;
3948
CELER_TRY_HANDLE(count = step(make_span(primaries)), log_context);
4049

test/celeritas/user/SimpleLoopTestBase.hh

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ class SimpleLoopTestBase : virtual public GlobalTestBase
3434
public:
3535
virtual VecPrimary make_primaries(size_type count) const = 0;
3636

37-
//! # primaries / # track slots
38-
virtual double initial_occupancy() const { return 1.0; }
37+
// # primaries given # track slots: default is passthrough
38+
virtual size_type initial_occupancy(size_type num_tracks) const;
3939

4040
protected:
4141
template<MemSpace M>

test/celeritas/user/SlotDiagnostic.test.cc

+27-4
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,11 @@ void SlotDiagnosticTest::RunResult::print_expected() const
134134
class TestEm3SlotTest : virtual public TestEm3Base,
135135
virtual public SlotDiagnosticTest
136136
{
137-
double initial_occupancy() const override { return 0.125; }
137+
protected:
138+
size_type initial_occupancy(size_type track_slots) const override
139+
{
140+
return static_cast<size_type>(0.125 * track_slots);
141+
}
138142

139143
auto build_init() -> SPConstTrackInit override
140144
{
@@ -265,15 +269,34 @@ TEST_F(TestEm3SlotTest, TEST_IF_CELER_DEVICE(device))
265269
}
266270
}
267271

268-
TEST_F(TestEm3SlotTest, DISABLED_long_demo)
272+
//---------------------------------------------------------------------------//
273+
class LongDemoTest : public TestEm3SlotTest
274+
{
275+
protected:
276+
size_type initial_occupancy(size_type) const final { return 16; }
277+
};
278+
279+
TEST_F(LongDemoTest, more_steps)
280+
{
281+
if (celeritas::device())
282+
{
283+
this->run<MemSpace::device>(32, 512);
284+
}
285+
else
286+
{
287+
this->run<MemSpace::host>(32, 512);
288+
}
289+
}
290+
291+
TEST_F(LongDemoTest, more_slots)
269292
{
270293
if (celeritas::device())
271294
{
272-
this->run<MemSpace::device>(512, 256);
295+
this->run<MemSpace::device>(96, 512);
273296
}
274297
else
275298
{
276-
this->run<MemSpace::host>(512, 256);
299+
this->run<MemSpace::host>(96, 512);
277300
}
278301
}
279302

0 commit comments

Comments
 (0)