alpaka
Abstraction Library for Parallel Kernel Acceleration
Unroll.hpp
Go to the documentation of this file.
1 /* Copyright 2021 Benjamin Worpitz, Bernhard Manfred Gruber
2  * SPDX-License-Identifier: MPL-2.0
3  */
4 
5 #pragma once
6 
8 
9 //! Suggests unrolling of the directly following loop to the compiler.
10 //!
11 //! Usage:
12 //! `ALPAKA_UNROLL
13 //! for(...){...}`
14 // \TODO: Implement for other compilers.
15 #if BOOST_ARCH_PTX
16 # define ALPAKA_UNROLL_STRINGIFY(x) #x
17 # define ALPAKA_UNROLL(...) _Pragma(ALPAKA_UNROLL_STRINGIFY(unroll __VA_ARGS__))
18 #elif BOOST_COMP_IBM || BOOST_COMP_SUNPRO || BOOST_COMP_HPACC
19 # define ALPAKA_UNROLL_STRINGIFY(x) #x
20 # define ALPAKA_UNROLL(...) _Pragma(ALPAKA_UNROLL_STRINGIFY(unroll(__VA_ARGS__)))
21 #elif BOOST_COMP_PGI
22 # define ALPAKA_UNROLL(...) _Pragma("unroll")
23 #else
24 # define ALPAKA_UNROLL(...)
25 #endif