diff --git a/man/lo2s.1.pod b/man/lo2s.1.pod index a7356fff..025073e7 100644 --- a/man/lo2s.1.pod +++ b/man/lo2s.1.pod @@ -27,6 +27,7 @@ S<[B<--metric-count> I | B<--metric-frequency> I]> S<[B<-x> I]> S<[B<-X>]> S<[B<-s SYSCALL>]> +S<[B<--accel ACCEL>]> S<{ I | I }> =item I := { I | B<--> I [I...] | B<-p> I } @@ -373,6 +374,24 @@ Record measurements for each sensor found by L. =back +=head2 B options + +=over + +=item B<--accel> I + +Record activity events (instruction samples or kernel execution information) for the given accelerator. Usable accelerators are "nec" for NEC SX-Aurora and "nvidia" for NVidia CUDA accelerators. + +=item B<--nec-readout-interval> I + +Set the interval (in microseconds) between NEC SX-Aurora instruction samples. + +=item B<--nec-check-interval> I + +Set the interval (in milliseconds) between checks for new NEC SX-Aurora processes. + +=back + =head2 Arguments to options =over diff --git a/src/config.cpp b/src/config.cpp index b7a42c34..ad1d23ac 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -160,8 +160,7 @@ void parse_program_options(int argc, const char** argv) auto& x86_energy_options = parser.group("x86_energy options"); auto& sensors_options = parser.group("sensors options"); auto& io_options = parser.group("I/O recording options"); - auto& nec_options = parser.group("NEC SX-Aurora Tsubasa recording options"); - auto& nvidia_options = parser.group("Nvidia CUDA instrumentation options"); + auto& accel_options = parser.group("Accelerator options"); lo2s::Config config; @@ -335,17 +334,19 @@ void parse_program_options(int argc, const char** argv) io_options.toggle("block-io", "Enable recording of block I/O events (requires access to debugfs)"); - nec_options.toggle("nec", "Enable NEC Vector Engine sampling"); - nec_options.option("nec-readout-interval", "NEC sampling interval") + + accel_options.multi_option("accel", "Accelerator to record execution events for").metavar("ACCEL").optional(); + + + accel_options.option("nec-readout-interval", "Accelerator sampling interval") .optional() .metavar("USEC") .default_value("1"); - nec_options.option("nec-check-interval", "The interval between checks for new VE processes") + accel_options.option("nec-check-interval", "The interval between checks for new VE processes") .optional() .metavar("MSEC") .default_value("100"); - nvidia_options.toggle("nvidia", "Enable Nvidia CUPTI instrumentation"); nitro::options::arguments arguments; try @@ -372,8 +373,6 @@ void parse_program_options(int argc, const char** argv) config.use_x86_energy = arguments.given("x86-energy"); config.use_sensors = arguments.given("sensors"); config.use_block_io = arguments.given("block-io"); - config.use_nec = arguments.given("nec"); - config.use_nvidia = arguments.given("nvidia"); config.command = arguments.positionals(); if (arguments.given("help")) @@ -487,6 +486,23 @@ void parse_program_options(int argc, const char** argv) } } + for (const auto& accel : arguments.get_all("accel")) + { + if(accel == "nec") + { + config.use_nec = true; + } + else if(accel == "nvidia") + { + config.use_nvidia = true; + } + else + { + std::cerr << "Unknown Accelerator " << accel << "!"; + std::exit(EXIT_FAILURE); + } + } + std::vector perf_group_events = arguments.get_all("metric-event"); std::vector perf_userspace_events = arguments.get_all("userspace-metric-event"); diff --git a/src/monitor/process_monitor_main.cpp b/src/monitor/process_monitor_main.cpp index 5d3e541d..8b38f30a 100644 --- a/src/monitor/process_monitor_main.cpp +++ b/src/monitor/process_monitor_main.cpp @@ -75,11 +75,13 @@ namespace monitor ptrace(PTRACE_TRACEME, 0, NULL, NULL); auto current_path = std::filesystem::current_path(); - Log::error() << current_path; - std::vector env = { "CUDA_INJECTION64_PATH=" + cuda_path, + std::vector env; + if(config().use_nvidia) + { + env = { "CUDA_INJECTION64_PATH=" + cuda_path, "LO2S_RINGBUF_SIZE=1024" }; - + } std::vector c_env; std::vector tmp;