GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — HPCTrainingExamples/HIPFort/hipgemm at main · amd/HPCTrainingExamples

Expand file tree

/

hipgemm

/
Copy path

Directory actions

More options

More options

Directory actions

More options

More options

Latest commit

 

History

History
History
/

hipgemm

/
Copy path

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Makefile
Makefile
 
 
README.md
README.md
 
 
gemm_mod.f90
gemm_mod.f90
 
 
gemm_prog.f90
gemm_prog.f90
 
 

README.md

Use the hipfort interface to make hip calls from Fortran

In this example, we are leveraging the hipfort interface to make a call to the C++ hipblas function hipblasZgemm. Namely, in the gemm_mod.f90 Fortran file, you can see the call to this C++ function made possible by the inclusion of the iso_c binding Fortran module and the hipfort and hipfort_hipblas Fortran modules. Note also the calls to the C++ HIP function hipDeviceSynchronize() made directly from Fortran.

It is important to note that the hipblas function hipblasZgemm requires arrays that exist on the device (GPU). For this, appropriate OpenMP target map directives are used to move the arrays from host (CPU) to device (GPU). This is done in gemm_prog.f90 the file.

Think about other ways you could have moved the memory from the host to the device, such as HIP for instance. Try to create a similar example where instead of a call from hipblas you are making a call from hipfft.

To run the example in this directory:

module load rocm
module load amdclang
module load hipfort
make

Note: loading the hipfort module sets the HIPFORT_INC environment variable that is used in the Makefile.

The make process will create four executables: gemm_global, gemm_local, gemm_global_sd, gemm_local_sd. The gemm_global has the matrices allocated outside of the matrix multiply function, and they are then supplied to the function as arguments, whereas gemm_local performs the allocation within the function call for the matrix multiplication. The variants with _sd use a one line openmp directive to perform the mapping of the data from the host to the device, whereas those without the _sd split the directives into multiple lines.

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.