Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4acb821

Browse filesBrowse files
committed
Fix tests that fail on devices that do not support double
1 parent 2bc08e7 commit 4acb821
Copy full SHA for 4acb821

File tree

Expand file treeCollapse file tree

3 files changed

+14
-1
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+14
-1
lines changed

‎test/binary.cpp

Copy file name to clipboardExpand all lines: test/binary.cpp
+6-1Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,12 @@ class PowPrecisionTest : public ::testing::TestWithParam<T> {
373373
vector<T> hres(1, 0); \
374374
B.host(&hres[0]); \
375375
std::fesetround(FE_TONEAREST); \
376-
T gold = (T)std::rint(std::pow((double)param, 2.0)); \
376+
T gold; \
377+
if (!af::isDoubleAvailable(af::getDevice())) { \
378+
gold = (T)std::rint(std::pow((float)param, 2.0f)); \
379+
} else { \
380+
gold = (T)std::rint(std::pow((double)param, 2.0)); \
381+
} \
377382
ASSERT_EQ(hres[0], gold); \
378383
}
379384

‎test/memory.cpp

Copy file name to clipboardExpand all lines: test/memory.cpp
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -917,6 +917,7 @@ TEST_F(MemoryManagerApi, E2ETest4D) {
917917
}
918918

919919
TEST_F(MemoryManagerApi, E2ETest4DComplexDouble) {
920+
SUPPORTED_TYPE_CHECK(double);
920921
size_t aSize = 8;
921922

922923
af::array a = af::array(aSize, aSize, aSize, aSize, af::dtype::c64);
@@ -932,6 +933,7 @@ TEST_F(MemoryManagerApi, E2ETest4DComplexDouble) {
932933
}
933934

934935
TEST_F(MemoryManagerApi, E2ETestMultipleAllocations) {
936+
SUPPORTED_TYPE_CHECK(double);
935937
size_t aSize = 8;
936938

937939
af::array a = af::array(aSize, af::dtype::c64);

‎test/reduce.cpp

Copy file name to clipboardExpand all lines: test/reduce.cpp
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,9 @@ TEST_P(ReduceByKeyP, SumDim0) {
559559
if (noHalfTests(GetParam()->kType_)) {
560560
GTEST_SKIP() << "Half not supported on this device";
561561
}
562+
if (noDoubleTests(GetParam()->vType_)) {
563+
GTEST_SKIP() << "Double not supported on this device";
564+
}
562565
array keyRes, valsReduced;
563566
sumByKey(keyRes, valsReduced, keys, vals, 0, 0);
564567

@@ -573,6 +576,9 @@ TEST_P(ReduceByKeyP, SumDim2) {
573576
if (noHalfTests(GetParam()->kType_)) {
574577
GTEST_SKIP() << "Half not supported on this device";
575578
}
579+
if (noDoubleTests(GetParam()->vType_)) {
580+
GTEST_SKIP() << "Double not supported on this device";
581+
}
576582
const int ntile = 2;
577583
vals = tile(vals, 1, ntile, 1, 1);
578584
vals = reorder(vals, 1, 2, 0, 3);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.