Adding new sleep after sync capability for data fabric profiling (#162)

Fixing missing header include for ROCM 3.0 changes
Этот коммит содержится в:
gilbertlee-amd
2019-12-12 15:20:54 -07:00
коммит произвёл GitHub
родитель 0092b35132
Коммит 2f4269d06d
2 изменённых файлов: 15 добавлений и 5 удалений
+13 -5
Просмотреть файл
@@ -27,6 +27,7 @@ THE SOFTWARE.
#include <cstdio>
#include <cstdlib>
#include <set>
#include <unistd.h>
#include <hip/hip_runtime.h>
#include "copy_kernel.h"
@@ -49,12 +50,13 @@ int main(int argc, char **argv)
printf("\n");
printf("Environment variables:\n");
printf("======================\n");
printf(" USE_HIP_CALL - Use hip calls (hipMemcpyAsync/hipMemset) instead of kernel\n");
printf(" USE_MEMSET - Write constant value (instead of doing a copy)\n");
printf(" USE_COARSE_MEM - Use coarse-grained dst GPU memory (instead of fine-grained)\n");
printf(" USE_SINGLE_SYNC - Only synchronize once at end of iterations (disables GPU times)\n");
printf(" USE_INTERACTIVE - Waits for user-input prior to start and after transfer loop (for profiling)\n");
printf(" USE_HIP_CALL - Use hip calls (hipMemcpyAsync/hipMemset) instead of kernel\n");
printf(" USE_MEMSET - Write constant value (instead of doing a copy)\n");
printf(" USE_COARSE_MEM - Use coarse-grained dst GPU memory (instead of fine-grained)\n");
printf(" USE_SINGLE_SYNC - Only synchronize once at end of iterations (disables GPU times)\n");
printf(" USE_INTERACTIVE - Waits for user-input prior to start and after transfer loop (for profiling)\n");
printf(" USE_ITERATIONS=N - Sets number of iterations to run (default is 10)\n");
printf(" USE_SLEEP - Adds a 100ms sleep after sync (for profiling)\n");
exit(0);
}
@@ -74,6 +76,7 @@ int main(int argc, char **argv)
bool useCoarseMem = getenv("USE_COARSE_MEM");
bool useSingleSync = getenv("USE_SINGLE_SYNC");
bool useInteractive = getenv("USE_INTERACTIVE");
bool useSleep = getenv("USE_SLEEP");
int numWarmups = 3;
int numIterations = getenv("USE_ITERATIONS") ? atoi(getenv("USE_ITERATIONS")) : 10;
@@ -99,6 +102,10 @@ int main(int argc, char **argv)
printf("Running in interactive mode (USE_INTERACTIVE)\n");
else
printf("Running in non-interactive mode (enable interactive mode via USE_INTERACTIVE)\n");
if (useSleep)
printf("Adding 100ms sleep after sync (USE_SLEEP)\n");
else
printf("No sleep per sync (enable sleep via USE_SLEEP)\n");
printf("Executing %d warmup iteration(s), and %d timed iteration(s) (Set via USE_ITERATION=#)\n",
numWarmups, numIterations);
@@ -314,6 +321,7 @@ int main(int argc, char **argv)
auto cpuDelta = std::chrono::high_resolution_clock::now() - cpuStart;
double deltaSec = std::chrono::duration_cast<std::chrono::duration<double>>(cpuDelta).count();
if (useSleep) usleep(100000);
if (iteration >= 0)
{