diff --git a/projects/hip/tests/src/gcc/LaunchKernel.c b/projects/hip/tests/src/gcc/LaunchKernel.c index 4ebe59d7c5..189d3ce614 100644 --- a/projects/hip/tests/src/gcc/LaunchKernel.c +++ b/projects/hip/tests/src/gcc/LaunchKernel.c @@ -27,21 +27,10 @@ */ -#include "hip/hip_runtime.h" +#include "../test_common.h" #include #include "LaunchKernel.h" -#define HIPCHECK(error) \ - { \ - hipError_t localError = error; \ - if ((localError != hipSuccess) && (localError != hipErrorPeerAccessAlreadyEnabled)) { \ - printf("%serror: '%s'(%d) from %s at %s:%d%s\n", "\x1B[31m", hipGetErrorString(localError), \ - localError, #error, __FILE__, __LINE__, "\x1B[0m"); \ - return false; \ - } \ - } - - bool LaunchKernelArg() { dim3 blocks = {1,1,1}; diff --git a/projects/hip/tests/src/test_common.h b/projects/hip/tests/src/test_common.h index 78aa845076..016cc34d52 100644 --- a/projects/hip/tests/src/test_common.h +++ b/projects/hip/tests/src/test_common.h @@ -17,13 +17,23 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include -#include -#if __CUDACC__ -#include -#else -#include +/* + * File is intended to C and CPP compliant hence any CPP specic changes + * should be added into CPP section + * + */ + +#ifdef __cplusplus + #include + #include + #if __CUDACC__ + #include + #else + #include + #endif #endif + +// ************************ GCC section ************************** #include #include "hip/hip_runtime.h" @@ -41,14 +51,6 @@ THE SOFTWARE. #define KCYN "\x1B[36m" #define KWHT "\x1B[37m" - -#ifdef __HIP_PLATFORM_HCC -#define TYPENAME(T) typeid(T).name() -#else -#define TYPENAME(T) "?" -#endif - - #define passed() \ printf("%sPASSED!%s\n", KGRN, KNRM); \ exit(0); @@ -114,6 +116,15 @@ extern int p_gpuDevice; extern unsigned p_verbose; extern int p_tests; +// ********************* CPP section ********************* +#ifdef __cplusplus + +#ifdef __HIP_PLATFORM_HCC +#define TYPENAME(T) typeid(T).name() +#else +#define TYPENAME(T) "?" +#endif + namespace HipTest { // Returns the current system time in microseconds @@ -470,3 +481,4 @@ struct MemTraits { }; }; // namespace HipTest +#endif //__cplusplus