forked from TESSEorg/ttg
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'ttg-device-support-master-coro-with-stream-tasks' of gi…
…thub.com:devreal/ttg into ttg-device-support-master-coro-with-stream-tasks
- Loading branch information
Showing
5 changed files
with
145 additions
and
47 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
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
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
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,40 @@ | ||
#ifndef TTG_PARSEC_DEVICE_H | ||
#define TTG_PARSEC_DEVICE_H | ||
|
||
#include "ttg/device/device.h" | ||
|
||
namespace ttg_parsec { | ||
|
||
namespace detail { | ||
|
||
// the first ID of an accelerator in the parsec ID-space | ||
inline int first_device_id = 0; | ||
|
||
/** | ||
* map from TTG ID-space to parsec ID-space | ||
*/ | ||
inline | ||
int device_to_parsec_device(const ttg::device::Device& device) { | ||
if (device.is_host()) { | ||
return 0; | ||
} else { | ||
return device.id() + first_device_id; | ||
} | ||
} | ||
|
||
/** | ||
* map from parsec ID-space to TTG ID-space | ||
*/ | ||
inline | ||
ttg::device::Device parsec_device_to_device(int parsec_id) { | ||
if (parsec_id < first_device_id) { | ||
return ttg::device::Device(parsec_id, ttg::ExecutionSpace::Host); | ||
} | ||
return ttg::device::Device(parsec_id - first_device_id, | ||
ttg::device::available_execution_space); | ||
} | ||
} // namespace detail | ||
|
||
} // namespace ttg_parsec | ||
|
||
#endif // TTG_PARSEC_DEVICE_H |
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