Porting CUDA Applications to Run on AMD GPUs

November 28, 2022

Helping developers increase ML, AI, and HPC performance and code portability

As organizations increasingly move to using open source and open standard solutions, their developers need the ability to write code once and be able to use it on multiple architectures. Many organizations use GPU-accelerated applications and infrastructure that limit users to a single accelerator hardware vendor. Developers face challenges in keeping up with ports and changing workloads where different devices are required and need the ability to move between different devices and architectures to run workloads across a variety of different hardware environments without buying new hardware to run a certain code. AMD developed a porting solution that allows developers to port code that is based on NVIDIA’s CUDA® API to run on AMD GPUs.

Introducing AMD ROCm™ Platform and HIPify Tools

The AMD ROCm™ open software platform provides tools to port CUDA-based code to AMD native open-source Heterogeneous Computing Interface for Portability (HIP) that can run on AMD Instinct™ accelerators including the latest MI200 series products. Developers can write their GPU applications and with very minimal changes be able to run their code in both NVIDIA and AMD environments.

Figure 1. ROCm™ open software ecosystem

When using ROCm, developers can run their software on the GPU accelerator, the CPU, and the server platform of their choice. AMD ROCm features include minimalism and modular software development for GPU computing. The ROCm software stack, represented by the black circle, enables a broad ecosystem of tools, libraries and applications as shown in Figure 1.

The AMD ROCm ecosystem includes support for the most popular open machine learning (ML) and high performance computing (HPC) frameworks including PyTorch, Tensorflow, ONNX-RT, RAJA, and a variety of other frameworks. ROCm works with a broad range of supporting libraries (BLAS, FFT, RNG, SPARSE, THRUST, MIOpen, and RCCL) as well as third party libraries. ROCm provides upstreamed Linux® Kernel support for major Linux distributions along with support for popular deployment, management tools and scale-out computing and toolchain programming models.

Benefits of using AMD HIP to convert code

  • HIP uses C++ which is familiar to many developers
  • HIP C++ code can be compiled using either AMD `hipcc` or CUDA® `nvcc`
  • HIP conversion provides customers with more choice in hardware and development tools
  • Can save developer time in moving between architectures making it easier to try different solutions on various GPUs
  • Aids in the development of compute-intensive applications

Porting CUDA to HIP steps

The porting conversion begins with running the HIP translator hipexamine-perl shell script to convert CUDA-based files (.cu) to HIP files (.cpp). This shell script runs to determine the CUDA code that can be converted to HIP. Compile (with `hipcc`) and run the application to begin the conversion. Most CUDA API calls can be converted one-for-one to HIP API calls by HIPIFY tools automatically.

Things to be aware of that may cause issues

Be aware of components (Makefile and build system changes) that may require manual intervention after the conversion. Inline PTX assembly, CUDA intrinsics, and inlined functions often have hard-coded dependencies on warp size which may need to be modified. Click here to see a complete example of running a CNN HIP conversion.

TempoQuest Ports AceCAST WRF CUDA-Based Code to AMD HIP

TempoQuest (TQI) developed their AceCAST™ Weather Research and Forecasting (WRF) software, a GPU-accelerated version of the WRF model, implemented using a combination of CUDA and OpenACC. TQI partnered with AMD to support AceCAST on AMD Instinct™ MI200 series GPUs. This is done using AMD’s HIP conversion tools, which convert the OpenACC-Fortran and CUDA-C based code to HIP to run on AMD GPU platforms.

TQI’s development team indicates that converting the code using the HIP conversion tools was trivial with only a few minor changes required for performance tuning and to accommodate for some minor CUDA-to-HIP incompatibilities. According to Gene Pache, TQI Founder and Chief Executive Officer, “Being able to run the accelerated WRF, AceCAST on AMD GPUs will greatly help the compute shortfall. The major benefit of our AceCAST software is the acceleration of the forecast process afforded by running on AMD GPUs.”

ORNL Uses HIP Conversion for Research on Frontier Exascale Supercomputer

The AMD GPU powered Frontier supercomputer located at the Oak Ridge Leadership Computing Facility (OLCF) at Oak Ridge National Laboratory (ORNL) became operational for pre-production testing in May 2022. Application developers on the Particle-in-cell (PIConGPU) team used AMD HIP to port and optimize the PIConGPU code to run on AMD GPUs. Frontier is powered by 2nd Generation AMD CDNA™ architecture and AMD Instinct MI200 series accelerators.

The CUDA-to-HIP conversion allowed the open source code to be portable between GPUs. Sunita Chandrasekaran leader of an international research team states, “A simulation that took two months on the previous Summit system now takes less than two weeks on the AMD GPU-powered Frontier system while allowing the team to run several 10-million time-step simulations.”

For more information on the AMD CUDA-to-HIP conversion, see:

AMD ROCm Resources

Helpful Resources:

Download the Porting CUDA Applications to Run on AMD GPUs Whitepaper Here

Subscribe to HPCwire's Weekly Update!

Be the most informed person in the room! Stay ahead of the tech trends with industy updates delivered to you every week!

Nvidia Touts Strong Results on Financial Services Inference Benchmark

February 3, 2023

The next-gen Hopper family may be on its way, but that isn’t stopping Nvidia’s popular A100 GPU from leading another benchmark on its way out. This time, it’s the STAC-ML inference benchmark, produced by the Securi Read more…

Quantum Computing Firm Rigetti Faces Delisting

February 3, 2023

Quantum computing companies are seeing their market caps crumble as investors patiently await out the winner-take-all approach to technology development. Quantum computing firms such as Rigetti Computing, IonQ and D-Wave went public through mergers with blank-check companies in the last two years, with valuations at the time of well over $1 billion. Now the market capitalization of these companies are less than half... Read more…

US and India Strengthen HPC, Quantum Ties Amid Tech Tension with China

February 2, 2023

Last May, the United States and India announced the “Initiative on Critical and Emerging Technology” (iCET), aimed at expanding the countries’ partnerships in strategic technologies and defense industries across th Read more…

Pittsburgh Supercomputing Enables Transparent Medicare Outcome AI

February 2, 2023

Medical applications of AI are replete with promise, but stymied by opacity: with lives on the line, concerns over AI models’ often-inscrutable reasoning – and as a result, possible biases embedded in those models Read more…

Europe’s LUMI Supercomputer Has Officially Been Accepted

February 1, 2023

“LUMI is officially here!” proclaimed the headline of a blog post written by Pekka Manninen, director of science and technology for CSC, Finland’s state-owned IT center. The EuroHPC-organized supercomputer’s most Read more…

AWS Solution Channel

Shutterstock 2069893598

Cost-effective and accurate genomics analysis with Sentieon on AWS

This blog post was contributed by Don Freed, Senior Bioinformatics Scientist, and Brendan Gallagher, Head of Business Development at Sentieon; and Olivia Choudhury, PhD, Senior Partner Solutions Architect, Sujaya Srinivasan, Genomics Solutions Architect, and Aniket Deshpande, Senior Specialist, HPC HCLS at AWS. Read more…

Microsoft/NVIDIA Solution Channel

Shutterstock 1453953692

Microsoft and NVIDIA Experts Talk AI Infrastructure

As AI emerges as a crucial tool in so many sectors, it’s clear that the need for optimized AI infrastructure is growing. Going beyond just GPU-based clusters, cloud infrastructure that provides low-latency, high-bandwidth interconnects and high-performance storage can help organizations handle AI workloads more efficiently and produce faster results. Read more…

Intel’s Gaudi3 AI Chip Survives Axe, Successor May Combine with GPUs

February 1, 2023

Intel's paring projects and products amid financial struggles, but AI products are taking on a major role as the company tweaks its chip roadmap to account for more computing specifically targeted at artificial intellige Read more…

Quantum Computing Firm Rigetti Faces Delisting

February 3, 2023

Quantum computing companies are seeing their market caps crumble as investors patiently await out the winner-take-all approach to technology development. Quantum computing firms such as Rigetti Computing, IonQ and D-Wave went public through mergers with blank-check companies in the last two years, with valuations at the time of well over $1 billion. Now the market capitalization of these companies are less than half... Read more…

US and India Strengthen HPC, Quantum Ties Amid Tech Tension with China

February 2, 2023

Last May, the United States and India announced the “Initiative on Critical and Emerging Technology” (iCET), aimed at expanding the countries’ partnership Read more…

Intel’s Gaudi3 AI Chip Survives Axe, Successor May Combine with GPUs

February 1, 2023

Intel's paring projects and products amid financial struggles, but AI products are taking on a major role as the company tweaks its chip roadmap to account for Read more…

Roadmap for Building a US National AI Research Resource Released

January 31, 2023

Last week the National AI Research Resource (NAIRR) Task Force released its final report and roadmap for building a national AI infrastructure to include comput Read more…

PFAS Regulations, 3M Exit to Impact Two-Phase Cooling in HPC

January 27, 2023

Per- and polyfluoroalkyl substances (PFAS), known as “forever chemicals,” pose a number of health risks to humans, with more suspected but not yet confirmed Read more…

Multiverse, Pasqal, and Crédit Agricole Tout Progress Using Quantum Computing in FS

January 26, 2023

Europe-based quantum computing pioneers Multiverse Computing and Pasqal, and global bank Crédit Agricole CIB today announced successful conclusion of a 1.5-yea Read more…

Critics Don’t Want Politicians Deciding the Future of Semiconductors

January 26, 2023

The future of the semiconductor industry was partially being decided last week by a mix of politicians, policy hawks and chip industry executives jockeying for Read more…

Riken Plans ‘Virtual Fugaku’ on AWS

January 26, 2023

The development of a national flagship supercomputer aimed at exascale computing continues to be a heated competition, especially in the United States, the Euro Read more…

Leading Solution Providers

Contributors

SC22 Booth Videos

AMD @ SC22
Altair @ SC22
AWS @ SC22
Ayar Labs @ SC22
CoolIT @ SC22
Cornelis Networks @ SC22
DDN @ SC22
Dell Technologies @ SC22
HPE @ SC22
Intel @ SC22
Intelligent Light @ SC22
Lancium @ SC22
Lenovo @ SC22
Microsoft and NVIDIA @ SC22
One Stop Systems @ SC22
Penguin Solutions @ SC22
QCT @ SC22
Supermicro @ SC22
Tuxera @ SC22
Tyan Computer @ SC22
  • arrow
  • Click Here for More Headlines
  • arrow
HPCwire