diff --git a/CMakeLists.txt b/CMakeLists.txt index 0fdc228c9e..e6cf1b72ce 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -302,6 +302,11 @@ set(TRACCC_ALGEBRA_PLUGINS ARRAY CACHE STRING "Algebra plugin to use in the buil message(STATUS "Building with plugin type: " ${TRACCC_ALGEBRA_PLUGINS}) add_definitions(-DALGEBRA_PLUGINS_INCLUDE_${TRACCC_ALGEBRA_PLUGINS}) +# Inform the code that it is being build in Release mode. +if (${CMAKE_BUILD_TYPE} STREQUAL "Release") + add_definitions(-DTRACCC_BUILD_TYPE_IS_RELEASE) +endif() + # Build the traccc code. add_subdirectory( core ) add_subdirectory( device/common ) diff --git a/examples/run/common/optimization_warning.hpp b/examples/run/common/optimization_warning.hpp new file mode 100644 index 0000000000..b6076e92c5 --- /dev/null +++ b/examples/run/common/optimization_warning.hpp @@ -0,0 +1,27 @@ +/** TRACCC library, part of the ACTS project (R&D line) + * + * (c) 2022 CERN for the benefit of the ACTS project + * + * Mozilla Public License Version 2.0 + */ + +#pragma once + +#include + +#if !defined(TRACCC_BUILD_TYPE_IS_RELEASE) || !defined(NDEBUG) || \ + defined(_DEBUG) +#define TRACCC_OPTIMIZATION_WARNING() \ + do { \ + std::cout \ + << "WARNING: traccc was built without Release mode, with out the " \ + "`NDEBUG` flag, or (on MSVC) with the `_DEBUG` flag. " \ + "Performance is guaranteed to be much lower and compute " \ + "performance results should be considered unreliable!" \ + << std::endl; \ + } while (false) +#else +#define TRACCC_OPTIMIZATION_WARNING() \ + do { \ + } while (false) +#endif diff --git a/examples/run/common/throughput_mt.ipp b/examples/run/common/throughput_mt.ipp index 5e679b941c..597e8f4d6a 100644 --- a/examples/run/common/throughput_mt.ipp +++ b/examples/run/common/throughput_mt.ipp @@ -18,6 +18,9 @@ #include "traccc/options/track_propagation.hpp" #include "traccc/options/track_seeding.hpp" +// Local include(s) +#include "../common/optimization_warning.hpp" + // I/O include(s). #include "traccc/io/demonstrator_edm.hpp" #include "traccc/io/read.hpp" @@ -72,6 +75,8 @@ int throughput_mt(std::string_view description, int argc, char* argv[], argc, argv}; + TRACCC_OPTIMIZATION_WARNING(); + // Set up the timing info holder. performance::timing_info times; @@ -242,6 +247,7 @@ int throughput_mt(std::string_view description, int argc, char* argv[], // Print some results. std::cout << "Reconstructed track parameters: " << rec_track_params.load() << std::endl; + TRACCC_OPTIMIZATION_WARNING(); std::cout << "Time totals:" << std::endl; std::cout << times << std::endl; std::cout << "Throughput:" << std::endl; @@ -251,6 +257,7 @@ int throughput_mt(std::string_view description, int argc, char* argv[], << performance::throughput{throughput_opts.processed_events, times, "Event processing"} << std::endl; + TRACCC_OPTIMIZATION_WARNING(); // Print results to log file if (throughput_opts.log_file != "\0") { diff --git a/examples/run/common/throughput_st.ipp b/examples/run/common/throughput_st.ipp index ad605e4f56..4988de7800 100644 --- a/examples/run/common/throughput_st.ipp +++ b/examples/run/common/throughput_st.ipp @@ -17,6 +17,9 @@ #include "traccc/options/track_propagation.hpp" #include "traccc/options/track_seeding.hpp" +// Local include(s) +#include "../common/optimization_warning.hpp" + // I/O include(s). #include "traccc/io/demonstrator_edm.hpp" #include "traccc/io/read.hpp" @@ -62,6 +65,8 @@ int throughput_st(std::string_view description, int argc, char* argv[], argc, argv}; + TRACCC_OPTIMIZATION_WARNING(); + // Set up the timing info holder. performance::timing_info times; @@ -192,6 +197,7 @@ int throughput_st(std::string_view description, int argc, char* argv[], // Print some results. std::cout << "Reconstructed track parameters: " << rec_track_params << std::endl; + TRACCC_OPTIMIZATION_WARNING(); std::cout << "Time totals:" << std::endl; std::cout << times << std::endl; std::cout << "Throughput:" << std::endl; @@ -201,6 +207,7 @@ int throughput_st(std::string_view description, int argc, char* argv[], << performance::throughput{throughput_opts.processed_events, times, "Event processing"} << std::endl; + TRACCC_OPTIMIZATION_WARNING(); // Return gracefully. return 0; diff --git a/examples/run/cpu/ccl_example.cpp b/examples/run/cpu/ccl_example.cpp index db6dbac9c7..eebdad23a1 100644 --- a/examples/run/cpu/ccl_example.cpp +++ b/examples/run/cpu/ccl_example.cpp @@ -11,6 +11,9 @@ #include "traccc/edm/cell.hpp" #include "traccc/io/read_cells.hpp" +// Local include(s). +#include "../common/optimization_warning.hpp" + // VecMem include(s). #include @@ -95,6 +98,8 @@ int main(int argc, char* argv[]) { return -1; } + TRACCC_OPTIMIZATION_WARNING(); + std::string event_file = std::string(argv[1]); std::cout << "Running " << argv[0] << " on " << event_file << std::endl; @@ -129,6 +134,7 @@ int main(int argc, char* argv[]) { auto time_process_p4 = std::chrono::high_resolution_clock::now(); + TRACCC_OPTIMIZATION_WARNING(); std::cout << "\nCPU budget allocation" << std::endl; std::cout << std::fixed; std::cout << std::setw(13) << "Component" @@ -155,6 +161,7 @@ int main(int argc, char* argv[]) { << " | " << std::setw(10) << std::setprecision(3) << delta_ms(time_read_start, time_process_p4) << " ms" << std::endl; + TRACCC_OPTIMIZATION_WARNING(); return 0; } diff --git a/examples/run/cpu/seeding_example.cpp b/examples/run/cpu/seeding_example.cpp index 12fc464fa4..31ec8fbc99 100644 --- a/examples/run/cpu/seeding_example.cpp +++ b/examples/run/cpu/seeding_example.cpp @@ -9,6 +9,9 @@ #include "traccc/definitions/common.hpp" #include "traccc/definitions/primitives.hpp" +// Local include(s). +#include "../common/optimization_warning.hpp" + // io #include "traccc/io/read_geometry.hpp" #include "traccc/io/read_measurements.hpp" @@ -261,6 +264,7 @@ int seq_run(const traccc::opts::track_seeding& seeding_opts, } } + TRACCC_OPTIMIZATION_WARNING(); std::cout << "==> Statistics ... " << std::endl; std::cout << "- read " << n_spacepoints << " spacepoints" << std::endl; std::cout << "- read " << n_measurements << " measurements" << std::endl; @@ -276,6 +280,7 @@ int seq_run(const traccc::opts::track_seeding& seeding_opts, } else { std::cout << "- ambiguity resolution: deactivated" << std::endl; } + TRACCC_OPTIMIZATION_WARNING(); return EXIT_SUCCESS; } diff --git a/examples/run/cpu/seq_example.cpp b/examples/run/cpu/seq_example.cpp index 44dbe496ed..d1b245d147 100644 --- a/examples/run/cpu/seq_example.cpp +++ b/examples/run/cpu/seq_example.cpp @@ -12,6 +12,9 @@ #include "traccc/io/utils.hpp" #include "traccc/io/write.hpp" +// Local include(s). +#include "../common/optimization_warning.hpp" + // algorithms #include "traccc/ambiguity_resolution/greedy_ambiguity_resolution_algorithm.hpp" #include "traccc/clusterization/clusterization_algorithm.hpp" @@ -336,6 +339,7 @@ int seq_run(const traccc::opts::input_data& input_opts, } } + TRACCC_OPTIMIZATION_WARNING(); std::cout << "==> Statistics ... " << std::endl; std::cout << "- read " << n_cells << " cells from " << n_modules << " modules" << std::endl; @@ -349,6 +353,7 @@ int seq_run(const traccc::opts::input_data& input_opts, std::cout << "- resolved " << n_ambiguity_free_tracks << " tracks" << std::endl; std::cout << "==> Elapsed times...\n" << elapsedTimes << std::endl; + TRACCC_OPTIMIZATION_WARNING(); return EXIT_SUCCESS; } diff --git a/examples/run/cuda/seeding_example_cuda.cpp b/examples/run/cuda/seeding_example_cuda.cpp index 4df4db85b4..1bde7fec77 100644 --- a/examples/run/cuda/seeding_example_cuda.cpp +++ b/examples/run/cuda/seeding_example_cuda.cpp @@ -37,6 +37,9 @@ #include "traccc/seeding/seeding_algorithm.hpp" #include "traccc/seeding/track_params_estimation.hpp" +// Local include(s). +#include "../common/optimization_warning.hpp" + // Detray include(s). #include "detray/core/detector.hpp" #include "detray/core/detector_metadata.hpp" @@ -455,6 +458,7 @@ int seq_run(const traccc::opts::track_seeding& seeding_opts, std::cout << nsd_performance_writer.generate_report_str(); } + TRACCC_OPTIMIZATION_WARNING(); std::cout << "==> Statistics ... " << std::endl; std::cout << "- read " << n_spacepoints << " spacepoints from " << n_modules << " modules" << std::endl; @@ -469,6 +473,7 @@ int seq_run(const traccc::opts::track_seeding& seeding_opts, std::cout << "- created (cuda) " << n_fitted_tracks_cuda << " fitted tracks" << std::endl; std::cout << "==>Elapsed times...\n" << elapsedTimes << std::endl; + TRACCC_OPTIMIZATION_WARNING(); return 0; } diff --git a/examples/run/cuda/seq_example_cuda.cpp b/examples/run/cuda/seq_example_cuda.cpp index f8442559c1..4c7787c8f9 100644 --- a/examples/run/cuda/seq_example_cuda.cpp +++ b/examples/run/cuda/seq_example_cuda.cpp @@ -39,6 +39,9 @@ #include "traccc/seeding/seeding_algorithm.hpp" #include "traccc/seeding/track_params_estimation.hpp" +// Local include(s). +#include "../common/optimization_warning.hpp" + // Detray include(s). #include "detray/core/detector.hpp" #include "detray/detectors/bfield.hpp" @@ -492,6 +495,7 @@ int seq_run(const traccc::opts::detector& detector_opts, sd_performance_writer.finalize(); } + TRACCC_OPTIMIZATION_WARNING(); std::cout << "==> Statistics ... " << std::endl; std::cout << "- read " << n_cells << " cells from " << n_modules << " modules" << std::endl; @@ -515,6 +519,7 @@ int seq_run(const traccc::opts::detector& detector_opts, std::cout << "- fitted (cuda) " << n_fitted_tracks_cuda << " tracks" << std::endl; std::cout << "==>Elapsed times...\n" << elapsedTimes << std::endl; + TRACCC_OPTIMIZATION_WARNING(); return 0; } diff --git a/examples/run/cuda/truth_finding_example_cuda.cpp b/examples/run/cuda/truth_finding_example_cuda.cpp index a12270a26e..c7dafb227e 100644 --- a/examples/run/cuda/truth_finding_example_cuda.cpp +++ b/examples/run/cuda/truth_finding_example_cuda.cpp @@ -33,6 +33,9 @@ #include "traccc/resolution/fitting_performance_writer.hpp" #include "traccc/utils/seed_generator.hpp" +// Local include(s). +#include "../common/optimization_warning.hpp" + // detray include(s). #include "detray/core/detector.hpp" #include "detray/core/detector_metadata.hpp" @@ -331,6 +334,7 @@ int seq_run(const traccc::opts::track_finding& finding_opts, fit_performance_writer.finalize(); } + TRACCC_OPTIMIZATION_WARNING(); std::cout << "==> Statistics ... " << std::endl; std::cout << "- created (cuda) " << n_found_tracks_cuda << " found tracks" << std::endl; @@ -341,6 +345,7 @@ int seq_run(const traccc::opts::track_finding& finding_opts, std::cout << "- created (cpu) " << n_fitted_tracks << " fitted tracks" << std::endl; std::cout << "==>Elapsed times...\n" << elapsedTimes << std::endl; + TRACCC_OPTIMIZATION_WARNING(); return 1; } diff --git a/examples/run/cuda/truth_fitting_example_cuda.cpp b/examples/run/cuda/truth_fitting_example_cuda.cpp index 7d5f485e79..4c4a888112 100644 --- a/examples/run/cuda/truth_fitting_example_cuda.cpp +++ b/examples/run/cuda/truth_fitting_example_cuda.cpp @@ -29,6 +29,9 @@ #include "traccc/resolution/fitting_performance_writer.hpp" #include "traccc/utils/seed_generator.hpp" +// Local include(s). +#include "../common/optimization_warning.hpp" + // detray include(s). #include "detray/core/detector.hpp" #include "detray/core/detector_metadata.hpp" @@ -249,12 +252,14 @@ int main(int argc, char* argv[]) { fit_performance_writer.finalize(); } + TRACCC_OPTIMIZATION_WARNING(); std::cout << "==> Statistics ... " << std::endl; std::cout << "- created (cuda) " << n_fitted_tracks_cuda << " fitted tracks" << std::endl; std::cout << "- created (cpu) " << n_fitted_tracks << " fitted tracks" << std::endl; std::cout << "==>Elapsed times...\n" << elapsedTimes << std::endl; + TRACCC_OPTIMIZATION_WARNING(); return EXIT_SUCCESS; } diff --git a/examples/run/kokkos/seeding_example_kokkos.cpp b/examples/run/kokkos/seeding_example_kokkos.cpp index f3e338200d..bf805fe5f7 100644 --- a/examples/run/kokkos/seeding_example_kokkos.cpp +++ b/examples/run/kokkos/seeding_example_kokkos.cpp @@ -23,6 +23,9 @@ #include "traccc/seeding/seeding_algorithm.hpp" #include "traccc/seeding/track_params_estimation.hpp" +// Local include(s). +#include "../common/optimization_warning.hpp" + // VecMem include(s). #include @@ -135,6 +138,7 @@ int seq_run(const traccc::opts::track_seeding& seeding_opts, sd_performance_writer.finalize(); } + TRACCC_OPTIMIZATION_WARNING(); std::cout << "==> Statistics ... " << std::endl; std::cout << "- read " << n_spacepoints << " spacepoints from " << n_modules << " modules" << std::endl; @@ -142,6 +146,7 @@ int seq_run(const traccc::opts::track_seeding& seeding_opts, std::cout << "- created (kokkos) " << n_seeds_kokkos << " seeds" << std::endl; std::cout << "==>Elapsed times...\n" << elapsedTimes << std::endl; + TRACCC_OPTIMIZATION_WARNING(); return 0; } diff --git a/examples/run/openmp/io_dec_par_example.cpp b/examples/run/openmp/io_dec_par_example.cpp index ec9d2a8b91..505c312b62 100644 --- a/examples/run/openmp/io_dec_par_example.cpp +++ b/examples/run/openmp/io_dec_par_example.cpp @@ -13,6 +13,9 @@ #include "traccc/edm/spacepoint.hpp" #include "traccc/io/demonstrator_edm.hpp" +// Local include(s). +#include "../common/optimization_warning.hpp" + // VecMem include(s). #include @@ -88,8 +91,10 @@ traccc::demonstrator_result run(traccc::demonstrator_input input_data, auto endAlgorithms = std::chrono::system_clock::now(); std::chrono::duration diffAlgo = endAlgorithms - startAlgorithms; + TRACCC_OPTIMIZATION_WARNING(); std::cout << "Algorithms time: " << diffAlgo.count() << " sec." << std::endl; + TRACCC_OPTIMIZATION_WARNING(); std::cout << "==> Statistics ... " << std::endl; std::cout << "- read " << n_cells << " cells from " << n_modules @@ -148,6 +153,8 @@ int main(int argc, char* argv[]) { auto end = std::chrono::system_clock::now(); std::chrono::duration diff = end - start; + TRACCC_OPTIMIZATION_WARNING(); std::cout << "Total execution time: " << diff.count() << " sec." << std::endl; + TRACCC_OPTIMIZATION_WARNING(); } diff --git a/examples/run/openmp/par_example.cpp b/examples/run/openmp/par_example.cpp index a50a0d7f68..2bbbc34335 100644 --- a/examples/run/openmp/par_example.cpp +++ b/examples/run/openmp/par_example.cpp @@ -17,6 +17,9 @@ #include "traccc/io/read_digitization_config.hpp" #include "traccc/io/read_geometry.hpp" +// Local include(s). +#include "../common/optimization_warning.hpp" + // VecMem include(s). #include @@ -163,6 +166,8 @@ int main(int argc, char *argv[]) { auto end = std::chrono::system_clock::now(); std::chrono::duration diff = end - start; + TRACCC_OPTIMIZATION_WARNING(); std::cout << "Execution time: " << diff.count() << " sec." << std::endl; + TRACCC_OPTIMIZATION_WARNING(); return result; } diff --git a/examples/run/sycl/seeding_example_sycl.sycl b/examples/run/sycl/seeding_example_sycl.sycl index 2090ec9ac7..0b1d7b621c 100644 --- a/examples/run/sycl/seeding_example_sycl.sycl +++ b/examples/run/sycl/seeding_example_sycl.sycl @@ -8,6 +8,9 @@ // SYCL include(s) #include +// Local include(s). +#include "../common/optimization_warning.hpp" + // algorithms #include "traccc/seeding/seeding_algorithm.hpp" #include "traccc/seeding/track_params_estimation.hpp" @@ -264,12 +267,14 @@ int seq_run(const traccc::opts::track_seeding& seeding_opts, sd_performance_writer.finalize(); } + TRACCC_OPTIMIZATION_WARNING(); std::cout << "==> Statistics ... " << std::endl; std::cout << "- read " << n_spacepoints << " spacepoints from " << n_modules << " modules" << std::endl; std::cout << "- created (cpu) " << n_seeds << " seeds" << std::endl; std::cout << "- created (sycl) " << n_seeds_sycl << " seeds" << std::endl; std::cout << "==>Elapsed times...\n" << elapsedTimes << std::endl; + TRACCC_OPTIMIZATION_WARNING(); return 0; } diff --git a/examples/run/sycl/seq_example_sycl.sycl b/examples/run/sycl/seq_example_sycl.sycl index 0515475feb..f2ad612dd7 100644 --- a/examples/run/sycl/seq_example_sycl.sycl +++ b/examples/run/sycl/seq_example_sycl.sycl @@ -8,6 +8,9 @@ // SYCL include(s) #include +// Local include(s). +#include "../common/optimization_warning.hpp" + // io #include "traccc/io/read_cells.hpp" #include "traccc/io/read_digitization_config.hpp" @@ -332,6 +335,7 @@ int seq_run(const traccc::opts::detector& detector_opts, sd_performance_writer.finalize(); } + TRACCC_OPTIMIZATION_WARNING(); std::cout << "==> Statistics ... " << std::endl; std::cout << "- read " << n_cells << " cells from " << n_modules << " modules" << std::endl; @@ -345,6 +349,7 @@ int seq_run(const traccc::opts::detector& detector_opts, std::cout << "- created (cpu) " << n_seeds << " seeds" << std::endl; std::cout << "- created (sycl) " << n_seeds_sycl << " seeds" << std::endl; std::cout << "==>Elapsed times...\n" << elapsedTimes << std::endl; + TRACCC_OPTIMIZATION_WARNING(); return 0; }