Skip to content

Commit

Permalink
Replace --nvidia,--nec with --accel, update man page
Browse files Browse the repository at this point in the history
  • Loading branch information
cvonelm committed Mar 12, 2024
1 parent 99396c4 commit 59737fd
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 11 deletions.
19 changes: 19 additions & 0 deletions man/lo2s.1.pod
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ S<[B<--metric-count> I<N> | B<--metric-frequency> I<HZ>]>
S<[B<-x> I<KNOB>]>
S<[B<-X>]>
S<[B<-s SYSCALL>]>
S<[B<--accel ACCEL>]>
S<{ I<PROCESS_MONITORING> | I<SYSTEM_MONITORING> }>

=item I<PROCESS_MONITORING> := { I<COMMAND> | B<--> I<COMMAND> [I<ARGS>...] | B<-p> I<PID> }
Expand Down Expand Up @@ -373,6 +374,24 @@ Record measurements for each sensor found by L<sensors(1)>.

=back

=head2 B<Accelerator> options

=over

=item B<--accel> I<ACCEL>

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<USEC>

Set the interval (in microseconds) between NEC SX-Aurora instruction samples.

=item B<--nec-check-interval> I<MSEC>

Set the interval (in milliseconds) between checks for new NEC SX-Aurora processes.

=back

=head2 Arguments to options

=over
Expand Down
32 changes: 24 additions & 8 deletions src/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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();

Check failure on line 339 in src/config.cpp

View check run for this annotation

Code Style Turtle / Code Formatting Test

src/config.cpp#L337-L339

- - accel_options.multi_option("accel", "Accelerator to record execution events for").metavar("ACCEL").optional(); - + 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");

Check failure on line 350 in src/config.cpp

View check run for this annotation

Code Style Turtle / Code Formatting Test

src/config.cpp#L350

-
nitro::options::arguments arguments;
try
Expand All @@ -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"))
Expand Down Expand Up @@ -487,6 +486,23 @@ void parse_program_options(int argc, const char** argv)
}
}

for (const auto& accel : arguments.get_all("accel"))
{
if(accel == "nec")
{

Check failure on line 492 in src/config.cpp

View check run for this annotation

Code Style Turtle / Code Formatting Test

src/config.cpp#L490-L492

- { - if(accel == "nec") - { + { + if (accel == "nec") + {
config.use_nec = true;
}
else if(accel == "nvidia")
{

Check failure on line 496 in src/config.cpp

View check run for this annotation

Code Style Turtle / Code Formatting Test

src/config.cpp#L494-L496

- } - else if(accel == "nvidia") - { + } + else if (accel == "nvidia") + {
config.use_nvidia = true;
}

Check failure on line 498 in src/config.cpp

View check run for this annotation

Code Style Turtle / Code Formatting Test

src/config.cpp#L498

- } + }
else
{

Check failure on line 500 in src/config.cpp

View check run for this annotation

Code Style Turtle / Code Formatting Test

src/config.cpp#L500

- { + {
std::cerr << "Unknown Accelerator " << accel << "!";
std::exit(EXIT_FAILURE);
}
}

Check failure on line 504 in src/config.cpp

View check run for this annotation

Code Style Turtle / Code Formatting Test

src/config.cpp#L503-L504

- } - } + } + }

std::vector<std::string> perf_group_events = arguments.get_all("metric-event");
std::vector<std::string> perf_userspace_events = arguments.get_all("userspace-metric-event");

Expand Down
8 changes: 5 additions & 3 deletions src/monitor/process_monitor_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::string> env = { "CUDA_INJECTION64_PATH=" + cuda_path,
std::vector<std::string> env;
if(config().use_nvidia)
{
env = { "CUDA_INJECTION64_PATH=" + cuda_path,
"LO2S_RINGBUF_SIZE=1024" };

}

Check failure on line 84 in src/monitor/process_monitor_main.cpp

View check run for this annotation

Code Style Turtle / Code Formatting Test

src/monitor/process_monitor_main.cpp#L80-L84

- if(config().use_nvidia) - { - env = { "CUDA_INJECTION64_PATH=" + cuda_path, - "LO2S_RINGBUF_SIZE=1024" }; - } + if (config().use_nvidia) + { + env = { "CUDA_INJECTION64_PATH=" + cuda_path, "LO2S_RINGBUF_SIZE=1024" }; + }
std::vector<char*> c_env;
std::vector<char*> tmp;

Expand Down

0 comments on commit 59737fd

Please sign in to comment.