4ae26e2d08
* renamed omnitrace_thread_data to thread_data
* initial implementation
* Numerous fixes and updates
- Updated timemory submodule
- Updated perfetto submodule (pulls in fixes for TRACE_EVENT)
- pthread_gotcha only after omnitrace_init_tooling
- omnitrace banner
- config settings for rocm-smi freq and devices
- critical_trace::get_entries
- OMNITRACE_BASIC_PRINT
- rocm_smi perfetto category
- redirect roctracer warnings for ROCm 4.5.0
- property specializations for rocm-smi components
- units fixes data_tracker types
- roctracer entries for pthread_create and start_thread
- omnitrace-avail defaults to settings, not components
- settings have conforming names
- settings warn about duplicates
- ptl named threads
- decreased max freq for sampler SIGALRM
- rocm-smi names thread
- rocm-smi avoids call to hipGetDeviceCount
- name roctracer activity callback threads
- fixed binary rewrite test output names
* Update lulesh example
- supports non-UVM GPU
* Lulesh tweaks + formatting
* KokkosP + Mode + Roctracer sampling deadlock fix
- kokkosp support
- omnitrace_init_library
- config::print_settings()
- config::get_mode()
- omnitrace::Mode
- omnitrace-avail improvements (removes settings)
- handle get_verbose() < 0
- disable dyninst InstrStackFrames by default
- handle perf_event_paranoid > 1 by disabling PAPI
- SIGALRM max freq to 5.0
- Name threads
- rocm-smi handles get_use_perfetto() and get_use_timemory()
- HSA_ENABLE_INTERRUPT=0 when roctracer + sampling (fixes deadlock)
* Tests, API renaming, roctracer
- disable renaming of thread 0
- verbprintf_bare
- enable dyninst merge tramp
- tweaked some omnitrace exe verbose levels
- reworked roctracer::setup and roctracer::shutdown
- rocm_smi::data::poll checks get_state()
- omnitrace_trace_finalize -> omnitrace_finalize
- omnitrace_trace_init -> omnitrace_init
- omnitrace_trace_set_env -> omnitrace_set_env
- omnitrace_trace_set_mpi -> omnitrace_set_mpi
- sampling mode does not disable timemory
- disable roctracer before shutting down rocm-smi
- lulesh tests w/ and w/o kokkosp
- lulesh tests for perfetto only
- with --dynamic-callsites --traps --allow-overlapping
- lulesh tests for timemory only
- with --stdlib --dynamic-callsites --traps --allow-overlapping
* Update timemory submodule
- fix for TIMEMORY_PROPERTY_SPECIALIZATION
* get_verbose() handling + timemory submodule update
- Findroctracer.cmake uses find_package(hsakmt)
* Stability fixes + rework roctracer + perfetto
- reworked roctracer start up
- critical_trace perfetto basic values
- perfetto sampling category
- sampler checks signals
- peak_rss in sampling
- pthread_gotcha::shutdown()
- rocm_smi::device_count()
- HSA_TOOLS_LIB is set
- HSA_ENABLE_INTERRUPT in omnitrace exe
- omnitrace exe verbosity level changes
- Avoid instrumenting Impl ns in Kokkos
- gpu::device_count prefers rocm_smi instead of hip
- ptl blocks signals
- fixed pthread_gotcha roctracer_data values
- removed runtime-instrument-sampling tests
- timemory submodule update
* cmake formatting
* timemory + roctracer updates
- fix timemory issue with papi_common
- fix timemory issue with units
- define roctracer::is_setup()
* Miscellaneous tweaks
- Disable sampling during runtime instrument
- Fixed warnings about dynamic callsites
- Fixed backtrace output when timemory disabled
- Test tweaks
* cmake-format
* omnitrace_target_compile_definitions
* timemory submodule update
* config, omnitrace, State, mpi_gotcha updates
- use OMNITRACE_THROW instead of direct throw
- is_attached()
- is_binary_rewrite()
- get_is_continuous_integration()
- get_debug_init()
- get_debug_finalize()
- max_thread_bookmarks default to 1
- State::Init
- app_thread oneTimeCode
- runtime instrumentation uses waitpid
- fixed init_names
- include main in MPI runs
- fixed sampling setup when disabled
- reworked mpi_gotcha
- disabled critical trace in transpose test
* cmake-format
* handle rocm_smi::device_count() exception
* CI timeouts
* Re-enable runtime-instrument + sampling
[ROCm/rocprofiler-systems commit: 39f17ae8b8]
273 行
8.5 KiB
C++
273 行
8.5 KiB
C++
#include <ctype.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#if USE_MPI
|
|
# include <mpi.h>
|
|
#endif
|
|
#include "lulesh.h"
|
|
|
|
/* Helper function for converting strings to ints, with error checking */
|
|
int
|
|
StrToInt(const char* token, int* retVal)
|
|
{
|
|
const char* c;
|
|
char* endptr;
|
|
const int decimal_base = 10;
|
|
|
|
if(token == NULL) return 0;
|
|
|
|
c = token;
|
|
*retVal = (int) strtol(c, &endptr, decimal_base);
|
|
if((endptr != c) && ((*endptr == ' ') || (*endptr == '\0')))
|
|
return 1;
|
|
else
|
|
return 0;
|
|
}
|
|
|
|
static void
|
|
PrintCommandLineOptions(char* execname, int myRank)
|
|
{
|
|
if(myRank == 0)
|
|
{
|
|
printf("Usage: %s [opts]\n", execname);
|
|
printf(" where [opts] is one or more of:\n");
|
|
printf(" -q : quiet mode - suppress all stdout\n");
|
|
printf(" -i <iterations> : number of cycles to run\n");
|
|
printf(" -s <size> : length of cube mesh along side\n");
|
|
printf(" -r <numregions> : Number of distinct regions (def: 11)\n");
|
|
printf(" -b <balance> : Load balance between regions of a domain (def: 1)\n");
|
|
printf(" -c <cost> : Extra cost of more expensive regions (def: 1)\n");
|
|
printf(" -f <numfiles> : Number of files to split viz dump into (def: "
|
|
"(np+10)/9)\n");
|
|
printf(" -p : Print out progress\n");
|
|
printf(
|
|
" -v : Output viz file (requires compiling with -DVIZ_MESH\n");
|
|
printf(" -h : This message\n");
|
|
printf("\n\n");
|
|
}
|
|
}
|
|
|
|
static void
|
|
ParseError(const char* message, int myRank)
|
|
{
|
|
if(myRank == 0)
|
|
{
|
|
printf("%s\n", message);
|
|
#if USE_MPI
|
|
MPI_Abort(MPI_COMM_WORLD, -1);
|
|
#else
|
|
exit(-1);
|
|
#endif
|
|
}
|
|
}
|
|
|
|
void
|
|
ParseCommandLineOptions(int argc, char* argv[], int myRank, struct cmdLineOpts* opts)
|
|
{
|
|
if(argc > 1)
|
|
{
|
|
int i = 1;
|
|
|
|
while(i < argc)
|
|
{
|
|
int ok;
|
|
/* -i <iterations> */
|
|
if(strcmp(argv[i], "-i") == 0)
|
|
{
|
|
if(i + 1 >= argc)
|
|
{
|
|
ParseError("Missing integer argument to -i", myRank);
|
|
}
|
|
ok = StrToInt(argv[i + 1], &(opts->its));
|
|
if(!ok)
|
|
{
|
|
ParseError("Parse Error on option -i integer value required after "
|
|
"argument\n",
|
|
myRank);
|
|
}
|
|
i += 2;
|
|
}
|
|
/* -s <size, sidelength> */
|
|
else if(strcmp(argv[i], "-s") == 0)
|
|
{
|
|
if(i + 1 >= argc)
|
|
{
|
|
ParseError("Missing integer argument to -s\n", myRank);
|
|
}
|
|
ok = StrToInt(argv[i + 1], &(opts->nx));
|
|
if(!ok)
|
|
{
|
|
ParseError("Parse Error on option -s integer value required after "
|
|
"argument\n",
|
|
myRank);
|
|
}
|
|
i += 2;
|
|
}
|
|
/* -r <numregions> */
|
|
else if(strcmp(argv[i], "-r") == 0)
|
|
{
|
|
if(i + 1 >= argc)
|
|
{
|
|
ParseError("Missing integer argument to -r\n", myRank);
|
|
}
|
|
ok = StrToInt(argv[i + 1], &(opts->numReg));
|
|
if(!ok)
|
|
{
|
|
ParseError("Parse Error on option -r integer value required after "
|
|
"argument\n",
|
|
myRank);
|
|
}
|
|
i += 2;
|
|
}
|
|
/* -f <numfilepieces> */
|
|
else if(strcmp(argv[i], "-f") == 0)
|
|
{
|
|
if(i + 1 >= argc)
|
|
{
|
|
ParseError("Missing integer argument to -f\n", myRank);
|
|
}
|
|
ok = StrToInt(argv[i + 1], &(opts->numFiles));
|
|
if(!ok)
|
|
{
|
|
ParseError("Parse Error on option -f integer value required after "
|
|
"argument\n",
|
|
myRank);
|
|
}
|
|
i += 2;
|
|
}
|
|
/* -p */
|
|
else if(strcmp(argv[i], "-p") == 0)
|
|
{
|
|
opts->showProg = 1;
|
|
i++;
|
|
}
|
|
/* -q */
|
|
else if(strcmp(argv[i], "-q") == 0)
|
|
{
|
|
opts->quiet = 1;
|
|
i++;
|
|
}
|
|
/* -q */
|
|
else if(strcmp(argv[i], "-a") == 0)
|
|
{
|
|
opts->do_atomic = 1;
|
|
i++;
|
|
}
|
|
else if(strcmp(argv[i], "-b") == 0)
|
|
{
|
|
if(i + 1 >= argc)
|
|
{
|
|
ParseError("Missing integer argument to -b\n", myRank);
|
|
}
|
|
ok = StrToInt(argv[i + 1], &(opts->balance));
|
|
if(!ok)
|
|
{
|
|
ParseError("Parse Error on option -b integer value required after "
|
|
"argument\n",
|
|
myRank);
|
|
}
|
|
i += 2;
|
|
}
|
|
else if(strcmp(argv[i], "-c") == 0)
|
|
{
|
|
if(i + 1 >= argc)
|
|
{
|
|
ParseError("Missing integer argument to -c\n", myRank);
|
|
}
|
|
ok = StrToInt(argv[i + 1], &(opts->cost));
|
|
if(!ok)
|
|
{
|
|
ParseError("Parse Error on option -c integer value required after "
|
|
"argument\n",
|
|
myRank);
|
|
}
|
|
i += 2;
|
|
}
|
|
/* -v */
|
|
else if(strcmp(argv[i], "-v") == 0)
|
|
{
|
|
#if VIZ_MESH
|
|
opts->viz = 1;
|
|
#else
|
|
ParseError("Use of -v requires compiling with -DVIZ_MESH\n", myRank);
|
|
#endif
|
|
i++;
|
|
}
|
|
/* -h */
|
|
else if(strcmp(argv[i], "-h") == 0)
|
|
{
|
|
PrintCommandLineOptions(argv[0], myRank);
|
|
#if USE_MPI
|
|
MPI_Abort(MPI_COMM_WORLD, 0);
|
|
#else
|
|
exit(0);
|
|
#endif
|
|
}
|
|
else
|
|
{
|
|
char msg[80];
|
|
PrintCommandLineOptions(argv[0], myRank);
|
|
sprintf(msg, "ERROR: Unknown command line argument: %s\n", argv[i]);
|
|
ParseError(msg, myRank);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
void
|
|
VerifyAndWriteFinalOutput(Real_t elapsed_time, Domain& locDom, Int_t nx, Int_t numRanks)
|
|
{
|
|
// GrindTime1 only takes a single domain into account, and is thus a good way to
|
|
// measure processor speed indepdendent of MPI parallelism. GrindTime2 takes into
|
|
// account speedups from MPI parallelism
|
|
Real_t grindTime1 = ((elapsed_time * 1e6) / locDom.cycle()) / (nx * nx * nx);
|
|
Real_t grindTime2 =
|
|
((elapsed_time * 1e6) / locDom.cycle()) / (nx * nx * nx * numRanks);
|
|
|
|
Index_t ElemId = 0;
|
|
auto h_e = Kokkos::create_mirror_view(locDom.e_view());
|
|
Kokkos::deep_copy(h_e, locDom.e_view());
|
|
printf("Run completed: \n");
|
|
printf(" Problem size = %i \n", nx);
|
|
printf(" MPI tasks = %i \n", numRanks);
|
|
printf(" Iteration count = %i \n", locDom.cycle());
|
|
printf(" Final Origin Energy = %12.6e \n", h_e(ElemId));
|
|
|
|
Real_t MaxAbsDiff = Real_t(0.0);
|
|
Real_t TotalAbsDiff = Real_t(0.0);
|
|
Real_t MaxRelDiff = Real_t(0.0);
|
|
|
|
for(Index_t j = 0; j < nx; ++j)
|
|
{
|
|
for(Index_t k = j + 1; k < nx; ++k)
|
|
{
|
|
Real_t AbsDiff = FABS(h_e(j * nx + k) - h_e(k * nx + j));
|
|
TotalAbsDiff += AbsDiff;
|
|
|
|
if(MaxAbsDiff < AbsDiff) MaxAbsDiff = AbsDiff;
|
|
|
|
Real_t RelDiff = AbsDiff / h_e(k * nx + j);
|
|
|
|
if(MaxRelDiff < RelDiff) MaxRelDiff = RelDiff;
|
|
}
|
|
}
|
|
|
|
// Quick symmetry check
|
|
printf(" Testing Plane 0 of Energy Array on rank 0:\n");
|
|
printf(" MaxAbsDiff = %12.6e\n", MaxAbsDiff);
|
|
printf(" TotalAbsDiff = %12.6e\n", TotalAbsDiff);
|
|
printf(" MaxRelDiff = %12.6e\n\n", MaxRelDiff);
|
|
|
|
// Timing information
|
|
printf("\nElapsed time = %10.2f (s)\n", elapsed_time);
|
|
printf("Grind time (us/z/c) = %10.8g (per dom) (%10.8g overall)\n", grindTime1,
|
|
grindTime2);
|
|
printf("FOM = %10.8g (z/s)\n\n",
|
|
1000.0 / grindTime2); // zones per second
|
|
|
|
return;
|
|
}
|