From 4ca05c1297ddec0d408271f7a3701f45d78baf6a Mon Sep 17 00:00:00 2001 From: Wenkai Du Date: Mon, 18 Nov 2019 14:17:29 -0800 Subject: [PATCH] Support bfloat16 on rest of the unit tests --- test/test_AllGather.cpp | 3 ++- test/test_Broadcast.cpp | 3 ++- test/test_CombinedCalls.cpp | 3 ++- test/test_GroupCalls.cpp | 3 ++- test/test_Reduce.cpp | 3 ++- test/test_Reduce.hpp | 3 +++ test/test_ReduceScatter.cpp | 3 ++- test/test_ReduceScatter.hpp | 3 +++ 8 files changed, 18 insertions(+), 6 deletions(-) diff --git a/test/test_AllGather.cpp b/test/test_AllGather.cpp index 2727514186..b28df48e87 100644 --- a/test/test_AllGather.cpp +++ b/test/test_AllGather.cpp @@ -101,7 +101,8 @@ namespace CorrectnessTests ncclUint64, //ncclFloat16, ncclFloat32, - ncclFloat64), + ncclFloat64, + ncclBfloat16), // Number of elements testing::Values(3072, 3145728), // Number of devices diff --git a/test/test_Broadcast.cpp b/test/test_Broadcast.cpp index 3ed6964785..0e728b0153 100644 --- a/test/test_Broadcast.cpp +++ b/test/test_Broadcast.cpp @@ -59,7 +59,8 @@ namespace CorrectnessTests ncclUint64, //ncclFloat16, ncclFloat32, - ncclFloat64), + ncclFloat64, + ncclBfloat16), // Number of elements testing::Values(1024, 1048576), // Number of devices diff --git a/test/test_CombinedCalls.cpp b/test/test_CombinedCalls.cpp index bdbf55bc20..4b51ab5375 100644 --- a/test/test_CombinedCalls.cpp +++ b/test/test_CombinedCalls.cpp @@ -89,7 +89,8 @@ namespace CorrectnessTests ncclUint64, //ncclFloat16, ncclFloat32, - ncclFloat64), + ncclFloat64, + ncclBfloat16), // Number of elements testing::Values(3072, 3145728), // Number of devices diff --git a/test/test_GroupCalls.cpp b/test/test_GroupCalls.cpp index de1ad0bd76..77780b633d 100644 --- a/test/test_GroupCalls.cpp +++ b/test/test_GroupCalls.cpp @@ -110,7 +110,8 @@ namespace CorrectnessTests ncclUint64, //ncclFloat16, ncclFloat32, - ncclFloat64), + ncclFloat64, + ncclBfloat16), // Number of elements testing::Values(3072, 3145728), // Number of devices diff --git a/test/test_Reduce.cpp b/test/test_Reduce.cpp index dfca79ccf4..9844e928c1 100644 --- a/test/test_Reduce.cpp +++ b/test/test_Reduce.cpp @@ -58,7 +58,8 @@ namespace CorrectnessTests ncclUint64, //ncclFloat16, ncclFloat32, - ncclFloat64), + ncclFloat64, + ncclBfloat16), // Number of elements testing::Values(1024, 1048576), // Number of devices diff --git a/test/test_Reduce.hpp b/test/test_Reduce.hpp index 3ab9d66b44..0303596560 100644 --- a/test/test_Reduce.hpp +++ b/test/test_Reduce.hpp @@ -29,6 +29,7 @@ namespace CorrectnessTests uint64_t* resultU8 = (uint64_t *)resultI1; float* resultF4 = (float *)resultI1; double* resultF8 = (double *)resultI1; + rccl_bfloat16* resultB2 = (rccl_bfloat16 *)resultI1; // Initialize the result with the first device's array memcpy(resultI1, dataset.expected[0], dataset.NumBytes()); @@ -44,6 +45,7 @@ namespace CorrectnessTests uint64_t* arrayU8 = (uint64_t *)arrayI1; float* arrayF4 = (float *)arrayI1; double* arrayF8 = (double *)arrayI1; + rccl_bfloat16* arrayB2 = (rccl_bfloat16 *)arrayI1; for (int j = 0; j < dataset.numElements; j++) { @@ -57,6 +59,7 @@ namespace CorrectnessTests case ncclUint64: resultU8[j] = ReduceOp(op, resultU8[j], arrayU8[j]); break; case ncclFloat32: resultF4[j] = ReduceOp(op, resultF4[j], arrayF4[j]); break; case ncclFloat64: resultF8[j] = ReduceOp(op, resultF8[j], arrayF8[j]); break; + case ncclBfloat16: resultB2[j] = ReduceOp(op, resultB2[j], arrayB2[j]); break; default: fprintf(stderr, "[ERROR] Unsupported datatype\n"); exit(0); diff --git a/test/test_ReduceScatter.cpp b/test/test_ReduceScatter.cpp index d55b514689..11007732b5 100644 --- a/test/test_ReduceScatter.cpp +++ b/test/test_ReduceScatter.cpp @@ -57,7 +57,8 @@ namespace CorrectnessTests ncclUint64, //ncclFloat16, ncclFloat32, - ncclFloat64), + ncclFloat64, + ncclBfloat16), // Number of elements testing::Values(3072, 3145728), // Number of devices diff --git a/test/test_ReduceScatter.hpp b/test/test_ReduceScatter.hpp index a1731f13b2..3a7843e2c1 100644 --- a/test/test_ReduceScatter.hpp +++ b/test/test_ReduceScatter.hpp @@ -29,6 +29,7 @@ namespace CorrectnessTests uint64_t* resultU8 = (uint64_t *)resultI1; float* resultF4 = (float *)resultI1; double* resultF8 = (double *)resultI1; + rccl_bfloat16* resultB2 = (rccl_bfloat16 *)resultI1; // Initialize the result with the first device's array memcpy(resultI1, dataset.expected[0], dataset.NumBytes()); @@ -44,6 +45,7 @@ namespace CorrectnessTests uint64_t* arrayU8 = (uint64_t *)arrayI1; float* arrayF4 = (float *)arrayI1; double* arrayF8 = (double *)arrayI1; + rccl_bfloat16* arrayB2 = (rccl_bfloat16 *)arrayI1; for (int j = 0; j < dataset.numElements; j++) { @@ -57,6 +59,7 @@ namespace CorrectnessTests case ncclUint64: resultU8[j] = ReduceOp(op, resultU8[j], arrayU8[j]); break; case ncclFloat32: resultF4[j] = ReduceOp(op, resultF4[j], arrayF4[j]); break; case ncclFloat64: resultF8[j] = ReduceOp(op, resultF8[j], arrayF8[j]); break; + case ncclBfloat16: resultB2[j] = ReduceOp(op, resultB2[j], arrayB2[j]); break; default: fprintf(stderr, "[ERROR] Unsupported datatype\n"); exit(0);