Skip to content

Commit f4ae64a

Browse files
committed
add isCUDA() on Type
1 parent 007d6ad commit f4ae64a

File tree

3 files changed

+3
-0
lines changed

3 files changed

+3
-0
lines changed

templates/Type.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ struct Type {
8888
virtual ~Type() {}
8989
virtual ScalarType scalarType() = 0;
9090
virtual Backend backend() = 0;
91+
virtual bool isCuda() = 0;
9192
virtual bool isSparse() = 0;
9293
virtual bool isDistributed() = 0;
9394
static void registerAll(Context * context);

templates/TypeDerived.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ ScalarType ${Type}::scalarType() {
1919
Backend ${Type}::backend() {
2020
return Backend::${Backend};
2121
}
22+
bool ${Type}::isCuda() { return backend() == kCUDA; }
2223
bool ${Type}::isSparse() { return false; }
2324
bool ${Type}::isDistributed() { return false; }
2425

templates/TypeDerived.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ struct ${Type} : public Type {
1010
explicit ${Type}(Context* context);
1111
virtual ScalarType scalarType() override;
1212
virtual Backend backend() override;
13+
virtual bool isCuda() override;
1314
virtual bool isSparse() override;
1415
virtual bool isDistributed() override;
1516
virtual std::unique_ptr<Storage> storage() override;

0 commit comments

Comments
 (0)