Skip to content

Commit

Permalink
Merge pull request #430 from vsnever/enhancement/apple_opencl
Browse files Browse the repository at this point in the history
Add support for Apple GPUs to get_flops() function.
  • Loading branch information
jacklovell committed Apr 4, 2024
2 parents 42d6e74 + 3e12081 commit bd36ca1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion cherab/tools/inversions/opencl/opencl_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def get_flops(device, verbose=False):
elif "amd" in vendor or "advanced" in vendor:
try:
ww = device.get_info(cl.device_info.WAVEFRONT_WIDTH_AMD)
except:
except AttributeError:
ww = 64
gflops = comp_units * ww * 2 * gpu_clock / 1000.

Expand All @@ -85,6 +85,10 @@ def get_flops(device, verbose=False):
elif "arm" in vendor:
gflops = comp_units * 2 * 16 * gpu_clock / 1000.

elif "apple" in vendor:
alu_lanes = 128
gflops = comp_units * 2 * alu_lanes * gpu_clock / 1000.

else:
warnings.warn('Unsupported device vendor: {}. Unable to estimate theoretical peak performance.'.format(vendor))
return 0
Expand Down

0 comments on commit bd36ca1

Please sign in to comment.