|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef _CUDA_CHRONO |
|
#define _CUDA_CHRONO |
|
|
|
#ifndef __CUDACC_RTC__ |
|
#include <chrono> |
|
#endif |
|
|
|
#include "ctime" |
|
#include "type_traits" |
|
#include "ratio" |
|
#include "limits" |
|
#include "version" |
|
|
|
#include "detail/__config" |
|
|
|
#include "detail/__pragma_push" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(_LIBCUDACXX_COMPILER_NVCC) |
|
# if (CUDART_VERSION >= 11050) |
|
# pragma nv_diag_suppress cuda_demote_unsupported_floating_point |
|
# else |
|
# pragma diag_suppress cuda_demote_unsupported_floating_point |
|
# endif |
|
#endif |
|
|
|
#include "detail/libcxx/include/chrono" |
|
|
|
_LIBCUDACXX_BEGIN_NAMESPACE_STD |
|
|
|
namespace chrono { |
|
|
|
inline _LIBCUDACXX_INLINE_VISIBILITY |
|
system_clock::time_point system_clock::now() _NOEXCEPT |
|
{ |
|
#ifdef __CUDA_ARCH__ |
|
uint64_t __time; |
|
asm volatile("mov.u64 %0, %globaltimer;":"=l"(__time)::); |
|
return time_point(duration_cast<duration>(nanoseconds(__time))); |
|
#else |
|
return time_point(duration_cast<duration>(nanoseconds( |
|
::std::chrono::duration_cast<::std::chrono::nanoseconds>( |
|
::std::chrono::system_clock::now().time_since_epoch() |
|
).count() |
|
))); |
|
#endif |
|
} |
|
|
|
inline _LIBCUDACXX_INLINE_VISIBILITY |
|
time_t system_clock::to_time_t(const system_clock::time_point& __t) _NOEXCEPT |
|
{ |
|
return time_t(duration_cast<seconds>(__t.time_since_epoch()).count()); |
|
} |
|
|
|
inline _LIBCUDACXX_INLINE_VISIBILITY |
|
system_clock::time_point system_clock::from_time_t(time_t __t) _NOEXCEPT |
|
{ |
|
return time_point(seconds(__t));; |
|
} |
|
} |
|
|
|
_LIBCUDACXX_END_NAMESPACE_STD |
|
|
|
#include "detail/__pragma_pop" |
|
|
|
#endif |
|
|
|
|
|
|