diff --git a/projects/clr/hipamd/src/hip_peer.cpp b/projects/clr/hipamd/src/hip_peer.cpp index cffb895c57..12a047e94f 100644 --- a/projects/clr/hipamd/src/hip_peer.cpp +++ b/projects/clr/hipamd/src/hip_peer.cpp @@ -129,7 +129,7 @@ hipError_t ihipEnablePeerAccess(hipCtx_t peerCtx, unsigned int flags) { LockedAccessor_CtxCrit_t peerCrit(peerCtx->criticalData()); // Add thisCtx to peerCtx's access list so that new allocations on peer will be made // visible to this device: - bool isNewPeer = peerCrit->addPeerWatcher(peerCtx, thisCtx); + bool isNewPeer = peerCrit->addPeerWatcher(thisCtx, peerCtx); if (isNewPeer) { tprintf(DB_MEM, "device=%s can now see all memory allocated on peer=%s\n", thisCtx->toString().c_str(), peerCtx->toString().c_str()); diff --git a/projects/clr/hipamd/tests/src/test_common.h b/projects/clr/hipamd/tests/src/test_common.h index 40f6fffd8e..bacbf35a22 100644 --- a/projects/clr/hipamd/tests/src/test_common.h +++ b/projects/clr/hipamd/tests/src/test_common.h @@ -19,7 +19,11 @@ THE SOFTWARE. #include #include +#if __CUDACC__ #include +#else +#include +#endif #include #include "hip/hip_runtime.h" @@ -105,9 +109,14 @@ namespace HipTest { // Returns the current system time in microseconds inline long long get_time() { +#if __CUDACC__ struct timeval tv; gettimeofday(&tv, 0); return (tv.tv_sec * 1000000) + tv.tv_usec; +#else + return std::chrono::high_resolution_clock::now().time_since_epoch() + /std::chrono::microseconds(1); +#endif } double elapsed_time(long long startTimeUs, long long stopTimeUs);