This repository has been archived by the owner on Mar 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 187
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support cuda::std::chrono with nvc++ (#394)
* Support cuda::std::chrono with nvc++ Replaces a use of __CUDA_ARCH__ in cuda::std::chrono with NV_IF_TARGET. * Use `NV_DISPATCH_TARGET` to select between host and device * Add tests for the cuda extensions --------- Co-authored-by: Michael Schellenberger Costa <[email protected]>
- Loading branch information
Showing
3 changed files
with
69 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
// <cuda/std/chrono> | ||
|
||
// system_clock | ||
|
||
// static time_point from_time_t(time_t t); | ||
|
||
#include <nv/target> | ||
|
||
#include <cuda/std/chrono> | ||
|
||
#include "test_macros.h" | ||
|
||
int main(int, char**) | ||
{ | ||
NV_IF_TARGET( | ||
NV_IS_HOST, ( | ||
typedef ::std::chrono::system_clock C; | ||
C::time_point t1 = C::from_time_t(C::to_time_t(C::now())); | ||
unused(t1); | ||
)); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
// <cuda/std/chrono> | ||
|
||
// system_clock | ||
|
||
// time_t to_time_t(const time_point& t); | ||
|
||
#include <nv/target> | ||
|
||
#include <cuda/std/chrono> | ||
|
||
#include "test_macros.h" | ||
|
||
int main(int, char**) | ||
{ | ||
NV_IF_TARGET( | ||
NV_IS_HOST, ( | ||
typedef ::std::chrono::system_clock C; | ||
cuda::std::time_t t1 = C::to_time_t(C::now()); | ||
unused(t1); | ||
)); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters