Skip to content

Commit

Permalink
Better debugging for GPU.
Browse files Browse the repository at this point in the history
  • Loading branch information
JulianKunkel committed Dec 23, 2022
1 parent 58049c0 commit 6aab769
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
7 changes: 6 additions & 1 deletion src/ior-output.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ static void PrintKeyValEnd(){
needNextToken = 1;
}

static void PrintKeyVal(char * key, char * value){
void PrintKeyVal(char * key, char * value){
if(value != NULL && value[0] != 0 && value[strlen(value) -1 ] == '\n'){
// remove \n
value[strlen(value) -1 ] = 0;
Expand Down Expand Up @@ -450,6 +450,11 @@ void ShowSetup(IOR_param_t *params)
if (params->memoryPerNode != 0){
PrintKeyVal("memoryPerNode", HumanReadable(params->memoryPerNode, BASE_TWO));
}

PrintKeyVal("memoryBuffer", params->gpuMemoryFlags == IOR_MEMORY_TYPE_CPU ? "CPU" : params->gpuMemoryFlags == IOR_MEMORY_TYPE_GPU_DEVICE_ONLY ? "GPU" : "Managed");
PrintKeyVal("dataAccess", params->gpuMemoryFlags > IOR_MEMORY_TYPE_GPU_MANAGED_CHECK_GPU ? "GPU" : "CPU");
PrintKeyVal("GPUDirect", params->gpuDirect ? "1" : "0");

PrintKeyValInt("repetitions", params->repetitions);
PrintKeyVal("xfersize", HumanReadable(params->transferSize, BASE_TWO));
PrintKeyVal("blocksize", HumanReadable(params->blockSize, BASE_TWO));
Expand Down
12 changes: 11 additions & 1 deletion src/ior.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,17 @@ static int test_initialize(IOR_test_t * test){
backend = test->params.backend;

#ifdef HAVE_CUDA
cudaError_t cret = cudaSetDevice(test->params.gpuID);
int device_count;
cudaError_t cret = cudaGetDeviceCount(& device_count);
if(cret != cudaSuccess){
ERRF("cudaGetDeviceCount() error: %d %s", (int) cret, cudaGetErrorString(cret));
}
{
char val[20];
sprintf(val, "%d", device_count);
PrintKeyVal("cudaDevices", val);
}
cret = cudaSetDevice(test->params.gpuID);
if(cret != cudaSuccess){
WARNF("cudaSetDevice(%d) error: %s", test->params.gpuID, cudaGetErrorString(cret));
}
Expand Down
4 changes: 0 additions & 4 deletions src/parse_options.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,6 @@ static void CheckRunSettings(IOR_test_t *tests)
if(params->dualMount && !params->filePerProc) {
ERR("Dual Mount can only be used with File Per Process");
}

if(params->gpuDirect){
params->gpuMemoryFlags = IOR_MEMORY_TYPE_GPU_DEVICE_ONLY;
}
}
}

Expand Down
1 change: 1 addition & 0 deletions src/utilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ void invalidate_buffer_pattern(char * buf, size_t bytes, ior_memory_flags type);
int verify_memory_pattern(uint64_t item, char * buffer, size_t bytes, int rand_seed, int pretendRank, ior_dataPacketType_e dataPacketType, ior_memory_flags type);
int verify_memory_pattern_gpu(uint64_t item, char * buffer, size_t bytes, int rand_seed, int pretendRank, ior_dataPacketType_e dataPacketType);

void PrintKeyVal(char * key, char * value);
char *CurrentTimeString(void);
int Regex(char *, char *);
void ShowFileSystemSize(char * filename, const struct ior_aiori * backend, void * backend_options);
Expand Down

0 comments on commit 6aab769

Please sign in to comment.