Migrating OceanFFT Sample from CUDA* to SYCL*

ID 791171
Updated 10/18/2023
Version Latest
Public

author-image

By

Overview

The OceanFFT sample demonstrates the usage of cuFFT library to synthesize and render an ocean surface in real time. The CUDA cuFFT library allows the floating-point power and parallelism of the GPU without having to develop a custom GPU-based FFT implementation. The equivalent FFT functions in oneAPI Math Kernel Library supports one, two, or three dimensions with mixed radices. The supported functions include complex-to-complex and real-to-complex transforms of arbitrary length in single-precision and double-precision. The original CUDA* source code is migrated to SYCL for portability across GPUs from multiple vendors.

Area

Description

What you will learn

How to migrate and map SYCL oneMKL FFT equivalent of CUFFT APIs

Time to complete

15 minutes

Category        

Concepts and Functionality

Key Implementation Details

This sample demonstrates the migration of the following prominent CUDA features:

  • CUDA FFT API (CUFFT)

The oceanFFT sample first generates wave heightfield at time based on initial heightfield and dispersion relationship. Then FFT API is executed in inverse order to convert to spatial domain. Finally, height map values and slope values are evaluated and compared with reference values to determine whether it is correct or wrong.

The sample is implemented in four mains steps.

  • Generate wave spectrum in frequency domain.
  • Execute inverse FFT to convert to spatial domain.
  • Update height map values based on output of FFT.
  • Calculate slope by partial differences in spatial domain.

 

Original CUDA source files: OceanFFT

Migrated SYCL source files including step by step instructions: guided_OceanFFT_SYCLmigration.

References