Skip to content

C6 Host and device ​

IDGroupTypeBackendsFigureProgram
C6ContractsCGPU (nvfortran OpenACC, tests-nvf-oac); CPU builds check the device path on the hostnogideon_test_device

Case and scope ​

Every kernel is !$acc routine seq and !$omp declare target, with compile-time coefficients: nothing is set up and nothing is copied to the device. This case runs every kernel inside an !$acc parallel loop on the GPU and compares each value with the host's. The device and the host may contract multiply-adds differently (FMA), so the comparison is a tolerance, and the number of bitwise-equal values is reported.

Models and numerics ​

ItemChoiceCode
Data65536 windows of random numbers in [−1,1), a fixed seed, Δs=0.37gideon_test_device.F90
Device callapply_dev, the registry's device-callable dispatcher (one select case per call, as a caller with a run-time choice would do), in one !$acc parallel loop per kernelgideon_test_registry.F90
Host callapply, the same kernels on the host
Asserted|rdev−rhost|≤64ε∑k|ck|max|q|/Δsn
Without OpenACCthe loop runs on the host: apply_dev against apply, which must agree bitwise

Program ​

bash
fobis build --mode tests-nvf-oac --build-dir exe/oac/     # GPU of compute capability $GPU_CC (fobos varsets)
CUDA_VISIBLE_DEVICES=1 ./exe/oac/gideon_test_device
scripts/run_report.sh --gpu                               # the same, into the report

Results ​

BuildWhereKernelsValuesBitwise equal to the hostWorst difference / magnitudeFailures
gfortran, R4Phost (no OpenACC)3322175795221757952 (100.0 %)00
gfortran, R8Phost (no OpenACC)3322175795221757952 (100.0 %)00
gfortran, R16Phost (no OpenACC)3322175795221757952 (100.0 %)00
nvfortran -acc, R8Pdevice (OpenACC)3322175795217983050 (82.7 %)4.3⋅10−160

The OpenACC run:

NVIDIA GeForce RTX 4070 (driver 610.88), nvfortran 26.9-0 64-bit target on x86-64 Linux -tp alderlake.

Findings ​

  • Every kernel computes on the device within the contraction tolerance; no failure.
  • On the GPU a share of the values (in the table) differs from the host's in the last bits, by a few ε of the scale at most: the device code and the host code contract multiply-adds differently. On the host, the three kinds of the gfortran build agree bitwise with the host path of the same kernels.
  • R16P is host only: an OpenACC build of gideon_kind_parameters in quadruple precision stops on #error (Precision).

Released under your choice of GPL-3.0-or-later, BSD-2-Clause, BSD-3-Clause or MIT.