Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Vaidh10/OpenACC-Practicecodes

Repository files navigation

OpenACC-Practicecodes

This repository contains functional code examples for parallel programming using OpenACC. The repository is intended to help users learn and practice using OpenACC directives to accelerate their own codes.

  • A OpenACC Compiler is required:
    • NVIDIA HPC SDK compiler
    • Cray compiler
    • GCC (Configured with OpenACC)
    • Clacc compiler (OpenACC support for clang/LLVM)

Build Instructions

OpenACC Practicecodes can be built using CMake as follows:

  1. Create a new directory for the build files and Change directory to the build directory.

  2. Run the cmake command to generate the build files, pointing it to the CMakeLists.txt file.

  3. Run the make command to build the project.You can then run the example programs by executing the resulting executables.

    $ mkdir build && cd build
    $ cmake -S ../ -B . -DCMAKE_C_COMPILER=nvc
    $ make
    $ ./<example_program>

OpenACC Practicecodes Compilation and Execution Guide

Compiling and executing OpenACC code individually for different compilers, without using CMake.

Compiling with GCC

To compile and run code for host:

export ACC_DEVICE_TYPE=host

gcc -fopenacc -foffload=disable program.c -o execfile -lm

To compile and run code for Nvidia and AMD GPU:

export ACC_DEVICE_TYPE=nvidia|radeon

gcc -fopenacc program.c -o execfile -lm
Compiling with NVIDIA

To compile and run code for host:

nvc -acc -ta=host -o execfile file.c

To compile and run code for multicores:

nvc -acc -⁠ta=multicore -o execfile file.c

To compile and run code for Nvidia GPU:

nvc -acc -gpu=[options] -o execfile file.c
Compiling with Clacc

To compile and run code for only host:

clang -fopenacc -o execfile file.c

To compile and run code for Nvidia and AMD GPU:

clang -fopenacc -fopenmp-targets=nvptx64-nvidia-cuda -o execfile file.c

clang -fopenacc -fopenmp-targets=amdgcn-amd-amdhsa -o execfile test.c
Executing the Code

To execute the compiled code, simply run the executable file:

./execfile

Contact

If you have any questions, issues, or suggestions related to this code, please feel free to contact the maintainers:

Additional Resources

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published