[dtests] Separated C macros from CPP header file (#1429)

* Separated C macros from CPP header file

* Updated review comment


[ROCm/hip commit: cde5119c9e]
This commit is contained in:
Sarbojit2019
2019-10-01 12:38:32 +05:30
کامیت شده توسط Maneesh Gupta
والد ef49c4f789
کامیت bfa8867a64
2فایلهای تغییر یافته به همراه27 افزوده شده و 26 حذف شده
@@ -27,21 +27,10 @@
*/ */
#include "hip/hip_runtime.h" #include "../test_common.h"
#include <stdio.h> #include <stdio.h>
#include "LaunchKernel.h" #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() bool LaunchKernelArg()
{ {
dim3 blocks = {1,1,1}; dim3 blocks = {1,1,1};
@@ -17,13 +17,23 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
*/ */
#include <iostream> /*
#include <iomanip> * File is intended to C and CPP compliant hence any CPP specic changes
#if __CUDACC__ * should be added into CPP section
#include <sys/time.h> *
#else */
#include <chrono>
#ifdef __cplusplus
#include <iostream>
#include <iomanip>
#if __CUDACC__
#include <sys/time.h>
#else
#include <chrono>
#endif
#endif #endif
// ************************ GCC section **************************
#include <stddef.h> #include <stddef.h>
#include "hip/hip_runtime.h" #include "hip/hip_runtime.h"
@@ -41,14 +51,6 @@ THE SOFTWARE.
#define KCYN "\x1B[36m" #define KCYN "\x1B[36m"
#define KWHT "\x1B[37m" #define KWHT "\x1B[37m"
#ifdef __HIP_PLATFORM_HCC
#define TYPENAME(T) typeid(T).name()
#else
#define TYPENAME(T) "?"
#endif
#define passed() \ #define passed() \
printf("%sPASSED!%s\n", KGRN, KNRM); \ printf("%sPASSED!%s\n", KGRN, KNRM); \
exit(0); exit(0);
@@ -114,6 +116,15 @@ extern int p_gpuDevice;
extern unsigned p_verbose; extern unsigned p_verbose;
extern int p_tests; 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 { namespace HipTest {
// Returns the current system time in microseconds // Returns the current system time in microseconds
@@ -470,3 +481,4 @@ struct MemTraits<MemcpyAsync> {
}; };
}; // namespace HipTest }; // namespace HipTest
#endif //__cplusplus