-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a test for the dependency on host-only types from alpaka libraries
Co-authored-by: Andres Rios Tascon <[email protected]>
- Loading branch information
Showing
7 changed files
with
71 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#ifndef HeterogeneousCore_AlpakaTest_interface_HostOnlyType_h | ||
#define HeterogeneousCore_AlpakaTest_interface_HostOnlyType_h | ||
|
||
namespace alpakatest { | ||
|
||
/* A simple class to demonstarte the dependency on host-only types from alpaka libraries */ | ||
class HostOnlyType { | ||
public: | ||
HostOnlyType() : value_{0} {} | ||
HostOnlyType(int value) : value_{value} {} | ||
void set(int value) { value_ = value; } | ||
int get() { return value_; } | ||
void print(); | ||
|
||
private: | ||
int value_; | ||
}; | ||
|
||
} // namespace alpakatest | ||
|
||
#endif // HeterogeneousCore_AlpakaTest_interface_HostOnlyType_h |
12 changes: 12 additions & 0 deletions
12
HeterogeneousCore/AlpakaTest/interface/alpaka/printAnswer.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#ifndef HeterogeneousCore_AlpakaTest_interface_alpaka_printAnswer_h | ||
#define HeterogeneousCore_AlpakaTest_interface_alpaka_printAnswer_h | ||
|
||
#include "HeterogeneousCore/AlpakaInterface/interface/config.h" | ||
|
||
namespace ALPAKA_ACCELERATOR_NAMESPACE::alpakatest { | ||
|
||
void printAnswer(); | ||
|
||
} // namespace ALPAKA_ACCELERATOR_NAMESPACE::alpakatest | ||
|
||
#endif // HeterogeneousCore_AlpakaTest_interface_alpaka_printAnswer_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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#include <iostream> | ||
|
||
#include "HeterogeneousCore/AlpakaTest/interface/HostOnlyType.h" | ||
|
||
namespace alpakatest { | ||
|
||
void HostOnlyType::print() { std::cout << "The HostOnlyType value is " << value_ << '\n'; } | ||
|
||
} // namespace alpakatest |
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,14 @@ | ||
#include "HeterogeneousCore/AlpakaInterface/interface/config.h" | ||
#include "HeterogeneousCore/AlpakaTest/interface/HostOnlyType.h" | ||
#include "HeterogeneousCore/AlpakaTest/interface/alpaka/printAnswer.h" | ||
|
||
namespace ALPAKA_ACCELERATOR_NAMESPACE::alpakatest { | ||
using namespace ::alpakatest; | ||
|
||
// A simple function to demonstarte the dependency on host-only types from alpaka libraries | ||
void printAnswer() { | ||
HostOnlyType answer(42); | ||
answer.print(); | ||
} | ||
|
||
} // namespace ALPAKA_ACCELERATOR_NAMESPACE::alpakatest |
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,8 @@ | ||
#include "HeterogeneousCore/AlpakaInterface/interface/config.h" | ||
#include "HeterogeneousCore/AlpakaTest/interface/alpaka/printAnswer.h" | ||
|
||
// each test binary is built for a single Alpaka backend | ||
using namespace ALPAKA_ACCELERATOR_NAMESPACE; | ||
using namespace ALPAKA_ACCELERATOR_NAMESPACE::alpakatest; | ||
|
||
int main() { printAnswer(); } |