From e0203f34f6ba6c878bcf6e63e776756d6caee0e9 Mon Sep 17 00:00:00 2001 From: Sam Yates <yates@cscs.ch> Date: Mon, 15 Oct 2018 11:38:15 +0200 Subject: [PATCH] Rename 'aux' namespace and paths to 'sup'. (#625) Fixes #622. --- CMakeLists.txt | 6 ++-- aux/CMakeLists.txt | 14 -------- example/bench/CMakeLists.txt | 2 +- example/bench/bench.cpp | 12 +++---- example/bench/parameters.cpp | 4 +-- example/brunel/CMakeLists.txt | 2 +- example/brunel/brunel_miniapp.cpp | 32 ++++++++--------- example/dryrun/CMakeLists.txt | 2 +- example/dryrun/dryrun.cpp | 10 +++--- example/dryrun/parameters.hpp | 4 +-- example/generators/CMakeLists.txt | 2 +- example/miniapp/CMakeLists.txt | 2 +- example/miniapp/io.hpp | 2 +- example/miniapp/miniapp.cpp | 34 +++++++++---------- example/miniapp/morphology_pool.cpp | 8 ++--- example/miniapp/morphology_pool.hpp | 4 +-- example/ring/CMakeLists.txt | 2 +- example/ring/parameters.hpp | 4 +-- example/ring/ring.cpp | 10 +++--- lmorpho/CMakeLists.txt | 2 +- lmorpho/lmorpho.cpp | 2 +- sup/CMakeLists.txt | 14 ++++++++ {aux => sup}/glob.cpp | 8 ++--- {aux/include/aux => sup/include/sup}/glob.hpp | 6 ++-- .../aux => sup/include/sup}/ioutil.hpp | 10 +++--- .../aux => sup/include/sup}/json_meter.hpp | 4 +-- .../aux => sup/include/sup}/json_params.hpp | 4 +-- {aux/include/aux => sup/include/sup}/path.hpp | 6 ++-- .../aux => sup/include/sup}/scope_exit.hpp | 4 +-- .../aux => sup/include/sup}/spike_emitter.hpp | 4 +-- .../aux => sup/include/sup}/strsub.hpp | 4 +-- .../aux => sup/include/sup}/tinyopt.hpp | 0 .../aux => sup/include/sup}/with_mpi.hpp | 4 +-- {aux => sup}/ioutil.cpp | 10 +++--- {aux => sup}/json_meter.cpp | 4 +-- {aux => sup}/path.cpp | 6 ++-- {aux => sup}/spike_emitter.cpp | 6 ++-- test/unit-distributed/CMakeLists.txt | 4 +-- test/unit-distributed/test.cpp | 8 ++--- test/unit/CMakeLists.txt | 2 +- test/unit/test_mask_stream.cpp | 4 +-- test/unit/test_path.cpp | 4 +-- test/unit/test_spike_emitter.cpp | 4 +-- test/validation/CMakeLists.txt | 2 +- test/validation/convergence_test.hpp | 4 +-- test/validation/validate.cpp | 2 +- test/validation/validate_ball_and_stick.cpp | 4 +-- test/validation/validate_synapses.cpp | 4 +-- test/validation/validation_data.cpp | 10 +++--- test/validation/validation_data.hpp | 12 +++---- 50 files changed, 159 insertions(+), 159 deletions(-) delete mode 100644 aux/CMakeLists.txt create mode 100644 sup/CMakeLists.txt rename {aux => sup}/glob.cpp (90%) rename {aux/include/aux => sup/include/sup}/glob.hpp (70%) rename {aux/include/aux => sup/include/sup}/ioutil.hpp (93%) rename {aux/include/aux => sup/include/sup}/json_meter.hpp (79%) rename {aux/include/aux => sup/include/sup}/json_params.hpp (96%) rename {aux/include/aux => sup/include/sup}/path.hpp (99%) rename {aux/include/aux => sup/include/sup}/scope_exit.hpp (96%) rename {aux/include/aux => sup/include/sup}/spike_emitter.hpp (87%) rename {aux/include/aux => sup/include/sup}/strsub.hpp (97%) rename {aux/include/aux => sup/include/sup}/tinyopt.hpp (100%) rename {aux/include/aux => sup/include/sup}/with_mpi.hpp (96%) rename {aux => sup}/ioutil.cpp (78%) rename {aux => sup}/json_meter.cpp (95%) rename {aux => sup}/path.cpp (96%) rename {aux => sup}/spike_emitter.cpp (87%) diff --git a/CMakeLists.txt b/CMakeLists.txt index ad65682d..b8c83fae 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -123,10 +123,10 @@ install(TARGETS arbor-public-deps EXPORT arbor-targets) add_subdirectory(ext) -# Auxilary/helper utiliies in `aux` are common across test executables -# and examples. Creates interface library `arbor-aux`. +# Support utiliies in `sup` are common across test executables +# and examples. Creates interface library `arbor-sup`. -add_subdirectory(aux) +add_subdirectory(sup) # Keep track of packages we need to add to the generated CMake config # file for arbor. diff --git a/aux/CMakeLists.txt b/aux/CMakeLists.txt deleted file mode 100644 index 2a23eb46..00000000 --- a/aux/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ -set(aux-sources - - glob.cpp - ioutil.cpp - json_meter.cpp - path.cpp - spike_emitter.cpp -) - -add_library(arbor-aux ${aux-sources}) -target_compile_options(arbor-aux PRIVATE ${ARB_CXXOPT_ARCH}) -target_link_libraries(arbor-aux PUBLIC ext-json arbor) -target_include_directories(arbor-aux PUBLIC include) -set_target_properties(arbor-aux PROPERTIES OUTPUT_NAME arboraux) diff --git a/example/bench/CMakeLists.txt b/example/bench/CMakeLists.txt index df585f11..5f07e0c7 100644 --- a/example/bench/CMakeLists.txt +++ b/example/bench/CMakeLists.txt @@ -1,4 +1,4 @@ add_executable(bench EXCLUDE_FROM_ALL bench.cpp recipe.cpp parameters.cpp) add_dependencies(examples bench) -target_link_libraries(bench PRIVATE arbor arbor-aux ext-tclap ext-json) +target_link_libraries(bench PRIVATE arbor arbor-sup ext-tclap ext-json) diff --git a/example/bench/bench.cpp b/example/bench/bench.cpp index 988b07b0..1bae7acf 100644 --- a/example/bench/bench.cpp +++ b/example/bench/bench.cpp @@ -18,10 +18,10 @@ #include <arbor/version.hpp> -#include <aux/ioutil.hpp> -#include <aux/json_meter.hpp> +#include <sup/ioutil.hpp> +#include <sup/json_meter.hpp> #ifdef ARB_MPI_ENABLED -#include <aux/with_mpi.hpp> +#include <sup/with_mpi.hpp> #endif #include "parameters.hpp" @@ -34,7 +34,7 @@ int main(int argc, char** argv) { try { #ifdef ARB_MPI_ENABLED - aux::with_mpi guard(argc, argv, false); + sup::with_mpi guard(argc, argv, false); auto context = arb::make_context(arb::proc_allocation(), MPI_COMM_WORLD); { int rank = 0; @@ -48,7 +48,7 @@ int main(int argc, char** argv) { profile::profiler_initialize(context); #endif - std::cout << aux::mask_stream(is_root); + std::cout << sup::mask_stream(is_root); bench_params params = read_options(argc, argv); @@ -81,7 +81,7 @@ int main(int argc, char** argv) { std::ofstream fid; fid.exceptions(std::ios_base::badbit | std::ios_base::failbit); fid.open("meters.json"); - fid << std::setw(1) << aux::to_json(report) << "\n"; + fid << std::setw(1) << sup::to_json(report) << "\n"; } // output profile and diagnostic feedback diff --git a/example/bench/parameters.cpp b/example/bench/parameters.cpp index b9ac4b2f..d2a42621 100644 --- a/example/bench/parameters.cpp +++ b/example/bench/parameters.cpp @@ -3,7 +3,7 @@ #include <iostream> #include <string> -#include <aux/json_params.hpp> +#include <sup/json_params.hpp> #include "parameters.hpp" @@ -42,7 +42,7 @@ std::ostream& operator<<(std::ostream& o, const bench_params& p) { } bench_params read_options(int argc, char** argv) { - using aux::param_from_json; + using sup::param_from_json; bench_params params; if (argc<2) { diff --git a/example/brunel/CMakeLists.txt b/example/brunel/CMakeLists.txt index 7614c809..d94f5f3e 100644 --- a/example/brunel/CMakeLists.txt +++ b/example/brunel/CMakeLists.txt @@ -3,4 +3,4 @@ add_executable(brunel-miniapp EXCLUDE_FROM_ALL io.cpp) add_dependencies(examples brunel-miniapp) -target_link_libraries(brunel-miniapp PRIVATE arbor arbor-aux ext-tclap) +target_link_libraries(brunel-miniapp PRIVATE arbor arbor-sup ext-tclap) diff --git a/example/brunel/brunel_miniapp.cpp b/example/brunel/brunel_miniapp.cpp index 4ac3dcb1..3bb10041 100644 --- a/example/brunel/brunel_miniapp.cpp +++ b/example/brunel/brunel_miniapp.cpp @@ -18,13 +18,13 @@ #include <arbor/simulation.hpp> #include <arbor/version.hpp> -#include <aux/ioutil.hpp> -#include <aux/json_meter.hpp> -#include <aux/path.hpp> -#include <aux/spike_emitter.hpp> -#include <aux/strsub.hpp> +#include <sup/ioutil.hpp> +#include <sup/json_meter.hpp> +#include <sup/path.hpp> +#include <sup/spike_emitter.hpp> +#include <sup/strsub.hpp> #ifdef ARB_MPI_ENABLED -#include <aux/with_mpi.hpp> +#include <sup/with_mpi.hpp> #include <mpi.h> #endif @@ -187,7 +187,7 @@ int main(int argc, char** argv) { try { #ifdef ARB_MPI_ENABLED - aux::with_mpi guard(argc, argv, false); + sup::with_mpi guard(argc, argv, false); auto context = arb::make_context(arb::proc_allocation(), MPI_COMM_WORLD); { MPI_Comm_rank(MPI_COMM_WORLD, &rank); @@ -197,7 +197,7 @@ int main(int argc, char** argv) { auto context = arb::make_context(); #endif - std::cout << aux::mask_stream(root); + std::cout << sup::mask_stream(root); banner(context); arb::profile::meter_manager meters; @@ -250,16 +250,16 @@ int main(int argc, char** argv) { if (options.spike_file_output) { using std::ios_base; - aux::path p = options.output_path; - p /= aux::strsub("%_%.%", options.file_name, rank, options.file_extension); + sup::path p = options.output_path; + p /= sup::strsub("%_%.%", options.file_name, rank, options.file_extension); if (options.single_file_per_rank) { - spike_out = aux::open_or_throw(p, ios_base::out, !options.over_write); - sim.set_local_spike_callback(aux::spike_emitter(spike_out)); + spike_out = sup::open_or_throw(p, ios_base::out, !options.over_write); + sim.set_local_spike_callback(sup::spike_emitter(spike_out)); } else if (rank==0) { - spike_out = aux::open_or_throw(p, ios_base::out, !options.over_write); - sim.set_global_spike_callback(aux::spike_emitter(spike_out)); + spike_out = sup::open_or_throw(p, ios_base::out, !options.over_write); + sim.set_global_spike_callback(sup::spike_emitter(spike_out)); } } @@ -280,12 +280,12 @@ int main(int argc, char** argv) { std::ofstream fid; fid.exceptions(std::ios_base::badbit | std::ios_base::failbit); fid.open("meters.json"); - fid << std::setw(1) << aux::to_json(report) << "\n"; + fid << std::setw(1) << sup::to_json(report) << "\n"; } } catch (io::usage_error& e) { // only print usage/startup errors on master - std::cerr << aux::mask_stream(root); + std::cerr << sup::mask_stream(root); std::cerr << e.what() << "\n"; return 1; } diff --git a/example/dryrun/CMakeLists.txt b/example/dryrun/CMakeLists.txt index 45a0745a..99ed83f0 100644 --- a/example/dryrun/CMakeLists.txt +++ b/example/dryrun/CMakeLists.txt @@ -1,4 +1,4 @@ add_executable(dryrun EXCLUDE_FROM_ALL dryrun.cpp) add_dependencies(examples dryrun) -target_link_libraries(dryrun PRIVATE arbor arbor-aux ext-json) +target_link_libraries(dryrun PRIVATE arbor arbor-sup ext-json) diff --git a/example/dryrun/dryrun.cpp b/example/dryrun/dryrun.cpp index 188bb987..0077a91b 100644 --- a/example/dryrun/dryrun.cpp +++ b/example/dryrun/dryrun.cpp @@ -22,14 +22,14 @@ #include <arbor/recipe.hpp> #include <arbor/version.hpp> -#include <aux/ioutil.hpp> -#include <aux/json_meter.hpp> +#include <sup/ioutil.hpp> +#include <sup/json_meter.hpp> #include "parameters.hpp" #ifdef ARB_MPI_ENABLED #include <mpi.h> -#include <aux/with_mpi.hpp> +#include <sup/with_mpi.hpp> #endif using arb::cell_gid_type; @@ -189,7 +189,7 @@ struct cell_stats { int main(int argc, char** argv) { try { #ifdef ARB_MPI_ENABLED - aux::with_mpi guard(argc, argv, false); + sup::with_mpi guard(argc, argv, false); #endif bool root = true; auto params = read_options(argc, argv); @@ -216,7 +216,7 @@ int main(int argc, char** argv) { #ifdef ARB_PROFILE_ENABLED arb::profile::profiler_initialize(ctx); #endif - std::cout << aux::mask_stream(root); + std::cout << sup::mask_stream(root); // Print a banner with information about hardware configuration std::cout << "gpu: " << (has_gpu(ctx)? "yes": "no") << "\n"; diff --git a/example/dryrun/parameters.hpp b/example/dryrun/parameters.hpp index ceb15af7..316ac3ce 100644 --- a/example/dryrun/parameters.hpp +++ b/example/dryrun/parameters.hpp @@ -7,7 +7,7 @@ #include <arbor/mc_cell.hpp> -#include <aux/json_params.hpp> +#include <sup/json_params.hpp> // Parameters used to generate the random cell morphologies. struct cell_parameters { @@ -37,7 +37,7 @@ struct run_params { }; run_params read_options(int argc, char** argv) { - using aux::param_from_json; + using sup::param_from_json; run_params params; if (argc<2) { diff --git a/example/generators/CMakeLists.txt b/example/generators/CMakeLists.txt index df774858..5b917bad 100644 --- a/example/generators/CMakeLists.txt +++ b/example/generators/CMakeLists.txt @@ -1,4 +1,4 @@ add_executable(event-gen EXCLUDE_FROM_ALL event_gen.cpp) add_dependencies(examples event-gen) -target_link_libraries(event-gen PRIVATE arbor arbor-aux ext-json) +target_link_libraries(event-gen PRIVATE arbor arbor-sup ext-json) diff --git a/example/miniapp/CMakeLists.txt b/example/miniapp/CMakeLists.txt index 8d04d959..d642cabf 100644 --- a/example/miniapp/CMakeLists.txt +++ b/example/miniapp/CMakeLists.txt @@ -7,4 +7,4 @@ add_executable(miniapp EXCLUDE_FROM_ALL ) add_dependencies(examples miniapp) -target_link_libraries(miniapp PRIVATE arbor arbor-aux ext-tclap ext-json) +target_link_libraries(miniapp PRIVATE arbor arbor-sup ext-tclap ext-json) diff --git a/example/miniapp/io.hpp b/example/miniapp/io.hpp index 8d300931..f19ee309 100644 --- a/example/miniapp/io.hpp +++ b/example/miniapp/io.hpp @@ -9,7 +9,7 @@ #include <arbor/common_types.hpp> #include <arbor/util/optional.hpp> -#include <aux/path.hpp> +#include <sup/path.hpp> // TODO: this shouldn't be in arb namespace namespace arb { diff --git a/example/miniapp/miniapp.cpp b/example/miniapp/miniapp.cpp index 97530ed0..3e34dd1c 100644 --- a/example/miniapp/miniapp.cpp +++ b/example/miniapp/miniapp.cpp @@ -17,13 +17,13 @@ #include <arbor/version.hpp> -#include <aux/ioutil.hpp> -#include <aux/json_meter.hpp> -#include <aux/path.hpp> -#include <aux/spike_emitter.hpp> -#include <aux/strsub.hpp> +#include <sup/ioutil.hpp> +#include <sup/json_meter.hpp> +#include <sup/path.hpp> +#include <sup/spike_emitter.hpp> +#include <sup/strsub.hpp> #ifdef ARB_MPI_ENABLED -#include <aux/with_mpi.hpp> +#include <sup/with_mpi.hpp> #include <mpi.h> #endif @@ -38,7 +38,7 @@ using util::any_cast; void banner(const context&); std::unique_ptr<recipe> make_recipe(const io::cl_options&, const probe_distribution&); sample_trace make_trace(const probe_info& probe); -std::fstream& open_or_throw(std::fstream& file, const aux::path& p, bool exclusive = false); +std::fstream& open_or_throw(std::fstream& file, const sup::path& p, bool exclusive = false); void report_compartment_stats(const recipe&); int main(int argc, char** argv) { @@ -47,7 +47,7 @@ int main(int argc, char** argv) { try { #ifdef ARB_MPI_ENABLED - aux::with_mpi guard(argc, argv, false); + sup::with_mpi guard(argc, argv, false); auto context = arb::make_context(arb::proc_allocation(), MPI_COMM_WORLD); { MPI_Comm_rank(MPI_COMM_WORLD, &rank); @@ -62,7 +62,7 @@ int main(int argc, char** argv) { profile::meter_manager meters; meters.start(context); - std::cout << aux::mask_stream(root); + std::cout << sup::mask_stream(root); // read parameters io::cl_options options = io::read_options(argc, argv, root); @@ -123,16 +123,16 @@ int main(int argc, char** argv) { if (options.spike_file_output) { using std::ios_base; - aux::path p = options.output_path; - p /= aux::strsub("%_%.%", options.file_name, rank, options.file_extension); + sup::path p = options.output_path; + p /= sup::strsub("%_%.%", options.file_name, rank, options.file_extension); if (options.single_file_per_rank) { - spike_out = aux::open_or_throw(p, ios_base::out, !options.over_write); - sim.set_local_spike_callback(aux::spike_emitter(spike_out)); + spike_out = sup::open_or_throw(p, ios_base::out, !options.over_write); + sim.set_local_spike_callback(sup::spike_emitter(spike_out)); } else if (rank==0) { - spike_out = aux::open_or_throw(p, ios_base::out, !options.over_write); - sim.set_global_spike_callback(aux::spike_emitter(spike_out)); + spike_out = sup::open_or_throw(p, ios_base::out, !options.over_write); + sim.set_global_spike_callback(sup::spike_emitter(spike_out)); } } @@ -160,12 +160,12 @@ int main(int argc, char** argv) { std::ofstream fid; fid.exceptions(std::ios_base::badbit | std::ios_base::failbit); fid.open("meters.json"); - fid << std::setw(1) << aux::to_json(report) << "\n"; + fid << std::setw(1) << sup::to_json(report) << "\n"; } } catch (io::usage_error& e) { // only print usage/startup errors on master - std::cerr << aux::mask_stream(root); + std::cerr << sup::mask_stream(root); std::cerr << e.what() << "\n"; return 1; } diff --git a/example/miniapp/morphology_pool.cpp b/example/miniapp/morphology_pool.cpp index 8515f20e..353913b1 100644 --- a/example/miniapp/morphology_pool.cpp +++ b/example/miniapp/morphology_pool.cpp @@ -5,8 +5,8 @@ #include <arbor/morphology.hpp> #include <arbor/swcio.hpp> -#include <aux/glob.hpp> -#include <aux/path.hpp> +#include <sup/glob.hpp> +#include <sup/path.hpp> #include "morphology_pool.hpp" @@ -31,7 +31,7 @@ static morphology make_basic_y_morphology() { morphology_pool default_morphology_pool(make_basic_y_morphology()); -void load_swc_morphology(morphology_pool& pool, const aux::path& swc_path) { +void load_swc_morphology(morphology_pool& pool, const sup::path& swc_path) { std::ifstream fi; fi.exceptions(std::ifstream::failbit); @@ -43,7 +43,7 @@ void load_swc_morphology_glob(morphology_pool& pool, const std::string& swc_patt std::ifstream fi; fi.exceptions(std::ifstream::failbit); - auto swc_paths = aux::glob(swc_pattern); + auto swc_paths = sup::glob(swc_pattern); for (const auto& p: swc_paths) { fi.open(p.c_str()); pool.insert(swc_as_morphology(parse_swc_file(fi))); diff --git a/example/miniapp/morphology_pool.hpp b/example/miniapp/morphology_pool.hpp index 31567c0b..5212982f 100644 --- a/example/miniapp/morphology_pool.hpp +++ b/example/miniapp/morphology_pool.hpp @@ -9,7 +9,7 @@ #include <vector> #include <arbor/morphology.hpp> -#include <aux/path.hpp> +#include <sup/path.hpp> namespace arb { @@ -34,7 +34,7 @@ public: extern morphology_pool default_morphology_pool; -void load_swc_morphology(morphology_pool& pool, const aux::path& swc_path); +void load_swc_morphology(morphology_pool& pool, const sup::path& swc_path); void load_swc_morphology_glob(morphology_pool& pool, const std::string& pattern); } // namespace arb diff --git a/example/ring/CMakeLists.txt b/example/ring/CMakeLists.txt index dc8ff649..48978586 100644 --- a/example/ring/CMakeLists.txt +++ b/example/ring/CMakeLists.txt @@ -1,4 +1,4 @@ add_executable(ring EXCLUDE_FROM_ALL ring.cpp) add_dependencies(examples ring) -target_link_libraries(ring PRIVATE arbor arbor-aux ext-tclap ext-json) +target_link_libraries(ring PRIVATE arbor arbor-sup ext-tclap ext-json) diff --git a/example/ring/parameters.hpp b/example/ring/parameters.hpp index 0ca046c4..74eb177d 100644 --- a/example/ring/parameters.hpp +++ b/example/ring/parameters.hpp @@ -7,7 +7,7 @@ #include <arbor/mc_cell.hpp> -#include <aux/json_params.hpp> +#include <sup/json_params.hpp> // Parameters used to generate the random cell morphologies. struct cell_parameters { @@ -38,7 +38,7 @@ struct ring_params { }; ring_params read_options(int argc, char** argv) { - using aux::param_from_json; + using sup::param_from_json; ring_params params; if (argc<2) { diff --git a/example/ring/ring.cpp b/example/ring/ring.cpp index ca91d5f1..f92950b9 100644 --- a/example/ring/ring.cpp +++ b/example/ring/ring.cpp @@ -21,14 +21,14 @@ #include <arbor/recipe.hpp> #include <arbor/version.hpp> -#include <aux/ioutil.hpp> -#include <aux/json_meter.hpp> +#include <sup/ioutil.hpp> +#include <sup/json_meter.hpp> #include "parameters.hpp" #ifdef ARB_MPI_ENABLED #include <mpi.h> -#include <aux/with_mpi.hpp> +#include <sup/with_mpi.hpp> #endif using arb::cell_gid_type; @@ -160,7 +160,7 @@ int main(int argc, char** argv) { bool root = true; #ifdef ARB_MPI_ENABLED - aux::with_mpi guard(argc, argv, false); + sup::with_mpi guard(argc, argv, false); auto context = arb::make_context(arb::proc_allocation(), MPI_COMM_WORLD); { int rank; @@ -175,7 +175,7 @@ int main(int argc, char** argv) { arb::profile::profiler_initialize(context); #endif - std::cout << aux::mask_stream(root); + std::cout << sup::mask_stream(root); // Print a banner with information about hardware configuration std::cout << "gpu: " << (has_gpu(context)? "yes": "no") << "\n"; diff --git a/lmorpho/CMakeLists.txt b/lmorpho/CMakeLists.txt index 0f338b9a..c198d458 100644 --- a/lmorpho/CMakeLists.txt +++ b/lmorpho/CMakeLists.txt @@ -1,6 +1,6 @@ add_executable(lmorpho lmorpho.cpp lsystem.cpp lsys_models.cpp morphio.cpp) -target_link_libraries(lmorpho PRIVATE arbor arbor-aux) +target_link_libraries(lmorpho PRIVATE arbor arbor-sup) # TODO: resolve public headers target_link_libraries(lmorpho PRIVATE arbor-private-headers) diff --git a/lmorpho/lmorpho.cpp b/lmorpho/lmorpho.cpp index 892a732c..56385a92 100644 --- a/lmorpho/lmorpho.cpp +++ b/lmorpho/lmorpho.cpp @@ -7,7 +7,7 @@ #include <arbor/morphology.hpp> #include <arbor/util/optional.hpp> -#include <aux/tinyopt.hpp> +#include <sup/tinyopt.hpp> #include "morphio.hpp" #include "lsystem.hpp" diff --git a/sup/CMakeLists.txt b/sup/CMakeLists.txt new file mode 100644 index 00000000..cdd4ecb0 --- /dev/null +++ b/sup/CMakeLists.txt @@ -0,0 +1,14 @@ +set(sup-sources + + glob.cpp + ioutil.cpp + json_meter.cpp + path.cpp + spike_emitter.cpp +) + +add_library(arbor-sup ${sup-sources}) +target_compile_options(arbor-sup PRIVATE ${ARB_CXXOPT_ARCH}) +target_link_libraries(arbor-sup PUBLIC ext-json arbor) +target_include_directories(arbor-sup PUBLIC include) +set_target_properties(arbor-sup PROPERTIES OUTPUT_NAME arborsup) diff --git a/aux/glob.cpp b/sup/glob.cpp similarity index 90% rename from aux/glob.cpp rename to sup/glob.cpp index 78d96edb..185cfc92 100644 --- a/aux/glob.cpp +++ b/sup/glob.cpp @@ -16,10 +16,10 @@ extern "C" { #include <cerrno> -#include <aux/path.hpp> -#include <aux/scope_exit.hpp> +#include <sup/path.hpp> +#include <sup/scope_exit.hpp> -namespace aux { +namespace sup { std::vector<path> glob(const std::string& pattern) { std::vector<path> paths; @@ -43,5 +43,5 @@ std::vector<path> glob(const std::string& pattern) { return paths; } -} // namespace aux +} // namespace sup diff --git a/aux/include/aux/glob.hpp b/sup/include/sup/glob.hpp similarity index 70% rename from aux/include/aux/glob.hpp rename to sup/include/sup/glob.hpp index 406167ce..aef8d68e 100644 --- a/aux/include/aux/glob.hpp +++ b/sup/include/sup/glob.hpp @@ -4,11 +4,11 @@ // TODO: emulate for not-entirely-POSIX platforms. -#include <aux/path.hpp> +#include <sup/path.hpp> -namespace aux { +namespace sup { std::vector<path> glob(const std::string& pattern); -} // namespace aux +} // namespace sup diff --git a/aux/include/aux/ioutil.hpp b/sup/include/sup/ioutil.hpp similarity index 93% rename from aux/include/aux/ioutil.hpp rename to sup/include/sup/ioutil.hpp index 2a9ba4ab..cf516dc0 100644 --- a/aux/include/aux/ioutil.hpp +++ b/sup/include/sup/ioutil.hpp @@ -14,9 +14,9 @@ #include <iostream> #include <fstream> -#include <aux/path.hpp> +#include <sup/path.hpp> -namespace aux { +namespace sup { template <typename charT, typename traitsT = std::char_traits<charT> > class basic_null_streambuf: public std::basic_streambuf<charT, traitsT> { @@ -87,12 +87,12 @@ private: bool mask_; }; -std::fstream open_or_throw(const aux::path& p, std::ios_base::openmode, bool exclusive); +std::fstream open_or_throw(const sup::path& p, std::ios_base::openmode, bool exclusive); -inline std::fstream open_or_throw(const aux::path& p, bool exclusive) { +inline std::fstream open_or_throw(const sup::path& p, bool exclusive) { using std::ios_base; return open_or_throw(p, ios_base::in|ios_base::out, exclusive); } -} // namespace aux +} // namespace sup diff --git a/aux/include/aux/json_meter.hpp b/sup/include/sup/json_meter.hpp similarity index 79% rename from aux/include/aux/json_meter.hpp rename to sup/include/sup/json_meter.hpp index 27489393..76c94ae8 100644 --- a/aux/include/aux/json_meter.hpp +++ b/sup/include/sup/json_meter.hpp @@ -1,8 +1,8 @@ #include <arbor/profile/meter_manager.hpp> #include <nlohmann/json.hpp> -namespace aux { +namespace sup { nlohmann::json to_json(const arb::profile::meter_report&); -} +} // namespace sup diff --git a/aux/include/aux/json_params.hpp b/sup/include/sup/json_params.hpp similarity index 96% rename from aux/include/aux/json_params.hpp rename to sup/include/sup/json_params.hpp index f7a848e2..7903b6cd 100644 --- a/aux/include/aux/json_params.hpp +++ b/sup/include/sup/json_params.hpp @@ -5,7 +5,7 @@ #include <nlohmann/json.hpp> -namespace aux { +namespace sup { // Search a json object for an entry with a given name. // If found, return the value and remove from json object. @@ -39,4 +39,4 @@ void param_from_json(std::array<T, N>& x, const char* name, nlohmann::json& j) { } } -} // namespace aux +} // namespace sup diff --git a/aux/include/aux/path.hpp b/sup/include/sup/path.hpp similarity index 99% rename from aux/include/aux/path.hpp rename to sup/include/sup/path.hpp index c5429cf5..0502d9a0 100644 --- a/aux/include/aux/path.hpp +++ b/sup/include/sup/path.hpp @@ -24,7 +24,7 @@ #include <utility> #include <vector> -namespace aux { +namespace sup { class posix_path { public: @@ -354,7 +354,7 @@ inline file_status symlink_status(const path& p, std::error_code& ec) { inline file_status status(const path& p) { std::error_code ec; - auto r = ::aux::posix::status(p, ec); + auto r = ::sup::posix::status(p, ec); if (ec) { throw filesystem_error("status()", p, ec); } @@ -409,5 +409,5 @@ inline bool exists(const path& p, std::error_code& ec) { return exists(status(p, ec)); } -} // namespace aux +} // namespace sup diff --git a/aux/include/aux/scope_exit.hpp b/sup/include/sup/scope_exit.hpp similarity index 96% rename from aux/include/aux/scope_exit.hpp rename to sup/include/sup/scope_exit.hpp index 4db228d8..67faeceb 100644 --- a/aux/include/aux/scope_exit.hpp +++ b/sup/include/sup/scope_exit.hpp @@ -5,7 +5,7 @@ // Convenience class for RAII control of resources. -namespace aux { +namespace sup { // `scope_exit` guard object will call provided functional object // on destruction. The provided functional object must be nothrow @@ -47,4 +47,4 @@ scope_exit<std::decay_t<F>> on_scope_exit(F&& f) { return scope_exit<std::decay_t<F>>(std::forward<F>(f)); } -} // namespace aux +} // namespace sup diff --git a/aux/include/aux/spike_emitter.hpp b/sup/include/sup/spike_emitter.hpp similarity index 87% rename from aux/include/aux/spike_emitter.hpp rename to sup/include/sup/spike_emitter.hpp index fdbfa16f..0656f00b 100644 --- a/aux/include/aux/spike_emitter.hpp +++ b/sup/include/sup/spike_emitter.hpp @@ -4,7 +4,7 @@ #include <arbor/spike.hpp> -namespace aux { +namespace sup { struct spike_emitter { std::reference_wrapper<std::ostream> out; @@ -13,4 +13,4 @@ struct spike_emitter { void operator()(const std::vector<arb::spike>&); }; -} // namespace aux +} // namespace sup diff --git a/aux/include/aux/strsub.hpp b/sup/include/sup/strsub.hpp similarity index 97% rename from aux/include/aux/strsub.hpp rename to sup/include/sup/strsub.hpp index b2dca849..35daea54 100644 --- a/aux/include/aux/strsub.hpp +++ b/sup/include/sup/strsub.hpp @@ -17,7 +17,7 @@ #include <string> #include <utility> -namespace aux { +namespace sup { // Stream-writing strsub(...): @@ -63,4 +63,4 @@ std::string strsub(const char* templ, Args&&... args) { return strsub('%', templ, std::forward<Args>(args)...); } -} // namespace aux +} // namespace sup diff --git a/aux/include/aux/tinyopt.hpp b/sup/include/sup/tinyopt.hpp similarity index 100% rename from aux/include/aux/tinyopt.hpp rename to sup/include/sup/tinyopt.hpp diff --git a/aux/include/aux/with_mpi.hpp b/sup/include/sup/with_mpi.hpp similarity index 96% rename from aux/include/aux/with_mpi.hpp rename to sup/include/sup/with_mpi.hpp index 6a0e21e5..8b7366f0 100644 --- a/aux/include/aux/with_mpi.hpp +++ b/sup/include/sup/with_mpi.hpp @@ -4,7 +4,7 @@ #include <arbor/communication/mpi_error.hpp> -namespace aux { +namespace sup { struct with_mpi { with_mpi(int& argc, char**& argv, bool fatal_errors = true) { @@ -36,4 +36,4 @@ private: } }; -} +} // namespace sup diff --git a/aux/ioutil.cpp b/sup/ioutil.cpp similarity index 78% rename from aux/ioutil.cpp rename to sup/ioutil.cpp index d6e723d6..4725cc1a 100644 --- a/aux/ioutil.cpp +++ b/sup/ioutil.cpp @@ -1,11 +1,11 @@ #include <fstream> #include <utility> -#include <aux/ioutil.hpp> -#include <aux/path.hpp> -#include <aux/strsub.hpp> +#include <sup/ioutil.hpp> +#include <sup/path.hpp> +#include <sup/strsub.hpp> -namespace aux { +namespace sup { std::fstream open_or_throw(const path& p, std::ios_base::openmode mode, bool exclusive) { if (exclusive && exists(p)) { @@ -21,5 +21,5 @@ std::fstream open_or_throw(const path& p, std::ios_base::openmode mode, bool exc return file; } -} // namespace aux +} // namespace sup diff --git a/aux/json_meter.cpp b/sup/json_meter.cpp similarity index 95% rename from aux/json_meter.cpp rename to sup/json_meter.cpp index ec9e8d96..c587d4df 100644 --- a/aux/json_meter.cpp +++ b/sup/json_meter.cpp @@ -1,7 +1,7 @@ #include <arbor/profile/meter_manager.hpp> #include <nlohmann/json.hpp> -namespace aux { +namespace sup { static nlohmann::json to_json(const arb::profile::measurement& mnt) { nlohmann::json measurements; @@ -30,4 +30,4 @@ nlohmann::json to_json(const arb::profile::meter_report& report) { }; } -} +} // namespace sup diff --git a/aux/path.cpp b/sup/path.cpp similarity index 96% rename from aux/path.cpp rename to sup/path.cpp index 64321b23..441e5768 100644 --- a/aux/path.cpp +++ b/sup/path.cpp @@ -5,9 +5,9 @@ extern "C" { #include <cerrno> -#include <aux/path.hpp> +#include <sup/path.hpp> -namespace aux { +namespace sup { namespace posix { namespace impl { @@ -64,5 +64,5 @@ file_status symlink_status(const path& p, std::error_code& ec) { } } // namespace posix -} // namespace arb +} // namespace sup diff --git a/aux/spike_emitter.cpp b/sup/spike_emitter.cpp similarity index 87% rename from aux/spike_emitter.cpp rename to sup/spike_emitter.cpp index db33121d..ec451be1 100644 --- a/aux/spike_emitter.cpp +++ b/sup/spike_emitter.cpp @@ -2,9 +2,9 @@ #include <iostream> #include <arbor/spike.hpp> -#include <aux/spike_emitter.hpp> +#include <sup/spike_emitter.hpp> -namespace aux { +namespace sup { spike_emitter::spike_emitter(std::ostream& out): out(out) {} @@ -20,4 +20,4 @@ void spike_emitter::operator()(const std::vector<arb::spike>& spikes) { } }; -} // namespace aux +} // namespace sup diff --git a/test/unit-distributed/CMakeLists.txt b/test/unit-distributed/CMakeLists.txt index a7c60af2..6b84f561 100644 --- a/test/unit-distributed/CMakeLists.txt +++ b/test/unit-distributed/CMakeLists.txt @@ -13,7 +13,7 @@ add_dependencies(tests unit-local) target_compile_options(unit-local PRIVATE ${ARB_CXXOPT_ARCH}) target_compile_definitions(unit-local PRIVATE TEST_LOCAL) -target_link_libraries(unit-local PRIVATE gtest arbor arbor-aux arbor-private-headers) +target_link_libraries(unit-local PRIVATE gtest arbor arbor-sup arbor-private-headers) if(ARB_WITH_MPI) add_executable(unit-mpi EXCLUDE_FROM_ALL ${unit-distributed_sources}) @@ -21,6 +21,6 @@ if(ARB_WITH_MPI) target_compile_options(unit-mpi PRIVATE ${ARB_CXXOPT_ARCH}) target_compile_definitions(unit-mpi PRIVATE TEST_MPI) - target_link_libraries(unit-mpi PRIVATE gtest arbor arbor-aux arbor-private-headers) + target_link_libraries(unit-mpi PRIVATE gtest arbor arbor-sup arbor-private-headers) endif() diff --git a/test/unit-distributed/test.cpp b/test/unit-distributed/test.cpp index 4f116af8..6dbbd018 100644 --- a/test/unit-distributed/test.cpp +++ b/test/unit-distributed/test.cpp @@ -7,10 +7,10 @@ #include <arbor/context.hpp> -#include <aux/ioutil.hpp> -#include <aux/tinyopt.hpp> +#include <sup/ioutil.hpp> +#include <sup/tinyopt.hpp> #ifdef TEST_MPI -#include <aux/with_mpi.hpp> +#include <sup/with_mpi.hpp> #endif #include "distributed_context.hpp" @@ -35,7 +35,7 @@ int main(int argc, char **argv) { alloc.gpu_id = -1; #ifdef TEST_MPI - aux::with_mpi guard(argc, argv, false); + sup::with_mpi guard(argc, argv, false); g_context = arb::make_context(alloc, MPI_COMM_WORLD); #elif defined(TEST_LOCAL) g_context = arb::make_context(alloc); diff --git a/test/unit/CMakeLists.txt b/test/unit/CMakeLists.txt index 103095c2..c78bf48c 100644 --- a/test/unit/CMakeLists.txt +++ b/test/unit/CMakeLists.txt @@ -145,4 +145,4 @@ add_dependencies(tests unit) target_compile_options(unit PRIVATE ${ARB_CXXOPT_ARCH}) target_compile_definitions(unit PRIVATE "-DDATADIR=\"${CMAKE_CURRENT_SOURCE_DIR}/swc\"") target_include_directories(unit PRIVATE "${CMAKE_CURRENT_BINARY_DIR}") -target_link_libraries(unit PRIVATE gtest arbor arbor-private-headers arbor-aux) +target_link_libraries(unit PRIVATE gtest arbor arbor-private-headers arbor-sup) diff --git a/test/unit/test_mask_stream.cpp b/test/unit/test_mask_stream.cpp index bdc7cd8d..bd544499 100644 --- a/test/unit/test_mask_stream.cpp +++ b/test/unit/test_mask_stream.cpp @@ -2,9 +2,9 @@ #include "../gtest.h" -#include <aux/ioutil.hpp> +#include <sup/ioutil.hpp> -using aux::mask_stream; +using sup::mask_stream; TEST(mask_stream,nomask) { // expect mask_stream(true) on a new stream not to change rdbuf. diff --git a/test/unit/test_path.cpp b/test/unit/test_path.cpp index d359dc2e..c52c4bbc 100644 --- a/test/unit/test_path.cpp +++ b/test/unit/test_path.cpp @@ -5,9 +5,9 @@ #include <string> #include <vector> -#include <aux/path.hpp> +#include <sup/path.hpp> -using namespace aux; +using namespace sup; TEST(path, posix_ctor) { // test constructor ans assignment overloads with sample character sequences. diff --git a/test/unit/test_spike_emitter.cpp b/test/unit/test_spike_emitter.cpp index 60af2a92..a6681277 100644 --- a/test/unit/test_spike_emitter.cpp +++ b/test/unit/test_spike_emitter.cpp @@ -5,11 +5,11 @@ #include <vector> #include <arbor/spike.hpp> -#include <aux/spike_emitter.hpp> +#include <sup/spike_emitter.hpp> TEST(spike_emitter, formatting) { std::stringstream out; - auto callback = aux::spike_emitter(out); + auto callback = sup::spike_emitter(out); std::vector<arb::spike> spikes = { { { 0, 0 }, 0.0 }, diff --git a/test/validation/CMakeLists.txt b/test/validation/CMakeLists.txt index 9e975a67..7d885e07 100644 --- a/test/validation/CMakeLists.txt +++ b/test/validation/CMakeLists.txt @@ -18,7 +18,7 @@ add_dependencies(tests validate) target_compile_options(validate PRIVATE ${ARB_CXXOPT_ARCH}) target_compile_definitions(validate PRIVATE "ARB_DATADIR=\"${ARB_VALIDATION_DATA_DIR}\"") -target_link_libraries(validate PRIVATE gtest arbor arbor-aux ext-json) +target_link_libraries(validate PRIVATE gtest arbor arbor-sup ext-json) if(ARB_BUILD_VALIDATION_DATA) add_dependencies(validate validation_data) diff --git a/test/validation/convergence_test.hpp b/test/validation/convergence_test.hpp index 25742cdb..e0ee8496 100644 --- a/test/validation/convergence_test.hpp +++ b/test/validation/convergence_test.hpp @@ -9,7 +9,7 @@ #include <arbor/simple_sampler.hpp> #include <arbor/simulation.hpp> #include <arbor/schedule.hpp> -#include <aux/path.hpp> +#include <sup/path.hpp> #include "../gtest.h" @@ -61,7 +61,7 @@ public: // Allow free access to JSON meta data attached to saved traces. nlohmann::json& metadata() { return meta_; } - void load_reference_data(const aux::path& ref_path) { + void load_reference_data(const sup::path& ref_path) { run_validation_ = false; try { ref_data_ = g_trace_io.load_traces(ref_path); diff --git a/test/validation/validate.cpp b/test/validation/validate.cpp index cac0ac3d..08293707 100644 --- a/test/validation/validate.cpp +++ b/test/validation/validate.cpp @@ -4,7 +4,7 @@ #include <string> #include <exception> -#include <aux/tinyopt.hpp> +#include <sup/tinyopt.hpp> #include "../gtest.h" diff --git a/test/validation/validate_ball_and_stick.cpp b/test/validation/validate_ball_and_stick.cpp index 2a047354..22f12314 100644 --- a/test/validation/validate_ball_and_stick.cpp +++ b/test/validation/validate_ball_and_stick.cpp @@ -11,7 +11,7 @@ #include <arbor/recipe.hpp> #include <arbor/simple_sampler.hpp> #include <arbor/simulation.hpp> -#include <aux/path.hpp> +#include <sup/path.hpp> #include "../common_cells.hpp" #include "../simple_recipes.hpp" @@ -33,7 +33,7 @@ struct probe_point { template <typename ProbePointSeq> void run_ncomp_convergence_test( const char* model_name, - const aux::path& ref_data_path, + const sup::path& ref_data_path, context& context, const mc_cell& c, ProbePointSeq& probe_points, diff --git a/test/validation/validate_synapses.cpp b/test/validation/validate_synapses.cpp index 92b43b97..a72d285a 100644 --- a/test/validation/validate_synapses.cpp +++ b/test/validation/validate_synapses.cpp @@ -7,7 +7,7 @@ #include <arbor/recipe.hpp> #include <arbor/simple_sampler.hpp> #include <arbor/simulation.hpp> -#include <aux/path.hpp> +#include <sup/path.hpp> #include "../gtest.h" @@ -24,7 +24,7 @@ using namespace arb; void run_synapse_test( const char* syn_type, - const aux::path& ref_data_path, + const sup::path& ref_data_path, const context& context, float t_end=70.f, float dt=0.001) diff --git a/test/validation/validation_data.cpp b/test/validation/validation_data.cpp index cf5963c4..3ddbaaa7 100644 --- a/test/validation/validation_data.cpp +++ b/test/validation/validation_data.cpp @@ -7,7 +7,7 @@ #include <nlohmann/json.hpp> #include <arbor/simple_sampler.hpp> -#include <aux/path.hpp> +#include <sup/path.hpp> #include "trace_analysis.hpp" #include "validation_data.hpp" @@ -20,7 +20,7 @@ trace_io g_trace_io; #define ARB_DATADIR "" #endif -aux::path trace_io::find_datadir() { +sup::path trace_io::find_datadir() { // If environment variable is set, use that in preference. if (const char* env_path = std::getenv("ARB_DATADIR")) { @@ -39,7 +39,7 @@ aux::path trace_io::find_datadir() { std::error_code ec; for (auto p: paths) { - if (aux::is_directory(p, ec)) { + if (sup::is_directory(p, ec)) { return p; } } @@ -97,8 +97,8 @@ static void parse_trace_json(const nlohmann::json& j, std::map<std::string, trac } } -std::map<std::string, trace_data<double>> trace_io::load_traces(const aux::path& name) { - aux::path file = datadir_/name; +std::map<std::string, trace_data<double>> trace_io::load_traces(const sup::path& name) { + sup::path file = datadir_/name; std::ifstream fid(file); if (!fid) { throw std::runtime_error("unable to load validation data: "+file.native()); diff --git a/test/validation/validation_data.hpp b/test/validation/validation_data.hpp index 620f79eb..bf827bf1 100644 --- a/test/validation/validation_data.hpp +++ b/test/validation/validation_data.hpp @@ -8,7 +8,7 @@ #include <nlohmann/json.hpp> #include <arbor/simple_sampler.hpp> -#include <aux/path.hpp> +#include <sup/path.hpp> namespace arb { @@ -46,7 +46,7 @@ public: void save_trace(const std::string& label, const trace_data<double>& data, const nlohmann::json& meta); void save_trace(const std::string& abscissa, const std::string& label, const trace_data<double>& data, const nlohmann::json& meta); - std::map<std::string, trace_data<double>> load_traces(const aux::path& name); + std::map<std::string, trace_data<double>> load_traces(const sup::path& name); // common flags, options set by driver @@ -62,9 +62,9 @@ public: void set_sample_dt(float dt) { sample_dt_ = dt; } float sample_dt() const { return sample_dt_; } - void set_datadir(const aux::path& dir) { datadir_ = dir; } + void set_datadir(const sup::path& dir) { datadir_ = dir; } - void set_output(const aux::path& file) { + void set_output(const sup::path& file) { out_.open(file); if (!out_) { throw std::runtime_error("unable to open file for writing"); @@ -80,7 +80,7 @@ public: } private: - aux::path datadir_; + sup::path datadir_; std::ofstream out_; nlohmann::json jtraces_ = nlohmann::json::array(); bool verbose_flag_ = false; @@ -93,7 +93,7 @@ private: // starting with ARB_DATADIR preprocessor define if defined and // if the directory exists, or else try './validation/data' // and '../validation/data'. - static aux::path find_datadir(); + static sup::path find_datadir(); }; extern trace_io g_trace_io; -- GitLab