Skip to content

Commit

Permalink
Superficial changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ABenC377 committed Apr 1, 2024
2 parents 258ac5d + 78c9bcd commit 57054b2
Showing 1 changed file with 48 additions and 1 deletion.
49 changes: 48 additions & 1 deletion include/doGemm.hh
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,55 @@ class doGemm {
gpuResult_once.gflops =
calcGflops(flops, iterations_, gpuResult_once.runtime);

#if !defined GPU_DEFAULT
if (!((std::fabs(cpuResult.checksum - gpuResult_once.checksum) < 0.5) &&
(std::fabs(cpuResult.checksum - gpuResult_always.checksum) < 0.5) &&
(std::fabs(cpuResult.checksum - gpuResult_unified.checksum) < 0.5))) {
std::cerr << "ERROR - " << getKernelName()
<< " kernel checksums do not match:\n\tInput dimensions: N="
<< N << std::endl;
std::cerr << std::setprecision(10)
<< "\tCPU Checksum = " << cpuResult.checksum << std::endl;
std::cerr << std::setprecision(10)
<< "\tGPU (Once) Checksum = " << gpuResult_once.checksum
<< std::endl;
std::cerr << std::setprecision(10)
<< "\tGPU (Always) Checksum = " << gpuResult_always.checksum
<< std::endl;
std::cerr << std::setprecision(10)
<< "\tGPU (Unified) Checksum = " << gpuResult_unified.checksum
<< std::endl;
exit(1);
}

// ToDo -- non-default GPU operations
// Check if offload threshold has been achieved for each GPU offload type.
// M can only be 0 when structure is newly initialised
if ((cpuGpu_once_.M == 0) && cpuResult.gflops < gpuResult_once.gflops) {
cpuGpu_once_.cpuGflops = cpuResult.gflops;
cpuGpu_once_.gpuGflops = gpuResult_once.gflops;
cpuGpu_once_.probSize_kib = probSize;
cpuGpu_once_.M = M;
cpuGpu_once_.N = N;
cpuGpu_once_.K = K;
}
if ((cpuGpu_always_.M == 0) && cpuResult.gflops < gpuResult_always.gflops) {
cpuGpu_always_.cpuGflops = cpuResult.gflops;
cpuGpu_always_.gpuGflops = gpuResult_always.gflops;
cpuGpu_always_.probSize_kib = probSize;
cpuGpu_always_.M = M;
cpuGpu_always_.N = N;
cpuGpu_always_.K = K;
}
if ((cpuGpu_unified_.M == 0) &&
cpuResult.gflops < gpuResult_unified.gflops) {
cpuGpu_unified_.cpuGflops = cpuResult.gflops;
cpuGpu_unified_.gpuGflops = gpuResult_unified.gflops;
cpuGpu_unified_.probSize_kib = probSize;
cpuGpu_unified_.M = M;
cpuGpu_unified_.N = N;
cpuGpu_unified_.K = K;
}
#endif

// Write lines to CSV file
writeLineToCsv(csvFile, "cpu", kernelName, N, N, N, probSize, iterations_,
Expand Down

0 comments on commit 57054b2

Please sign in to comment.