Adding better naming to unit tests for filtering; adding short and full unit test suites (#235)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
35c5a7fe45
Коммит
684f3e6af4
+25
-9
@@ -12,7 +12,8 @@ function display_help()
|
||||
echo " [-i|--install] install RCCL library (see --prefix argument below.)"
|
||||
echo " [-p|--package_build] Build RCCL package."
|
||||
echo " [-t|--tests_build] Build unit tests, but do not run."
|
||||
echo " [-r|--run_tests] Run unit tests (must be built already.)"
|
||||
echo " [-r|--run_tests_quick] Run small subset of unit tests (must be built already.)"
|
||||
echo " [--run_tests_all] Run all unit tests (must be built already.)"
|
||||
echo " [--hcc] Build library using deprecated hcc compiler (default:hip-clang)."
|
||||
echo " [--prefix] Specify custom directory to install RCCL to (default: /opt/rocm)."
|
||||
}
|
||||
@@ -25,9 +26,11 @@ build_package=false
|
||||
install_prefix=$default_path
|
||||
build_tests=false
|
||||
run_tests=false
|
||||
run_tests_all=false
|
||||
build_release=true
|
||||
install_library=false
|
||||
build_hip_clang=true
|
||||
clean_build=true
|
||||
install_dependencies=false
|
||||
|
||||
# #################################################
|
||||
@@ -37,7 +40,7 @@ install_dependencies=false
|
||||
# check if we have a modern version of getopt that can handle whitespace and long parameters
|
||||
getopt -T
|
||||
if [[ $? -eq 4 ]]; then
|
||||
GETOPT_PARSE=$(getopt --name "${0}" --longoptions help,install,package_build,tests_build,run_tests,hcc,hip-clang,prefix: --options hiptr -- "$@")
|
||||
GETOPT_PARSE=$(getopt --name "${0}" --longoptions help,install,dependencies,package_build,tests_build,run_tests_quick,run_tests_all,hcc,hip-clang,no_clean,prefix: --options hiptr -- "$@")
|
||||
else
|
||||
echo "Need a new version of getopt"
|
||||
exit 1
|
||||
@@ -68,15 +71,22 @@ while true; do
|
||||
-t|--tests_build)
|
||||
build_tests=true
|
||||
shift ;;
|
||||
-r|--run_tests)
|
||||
-r|--run_tests_quick)
|
||||
run_tests=true
|
||||
shift ;;
|
||||
--run_tests_all)
|
||||
run_tests=true
|
||||
run_tests_all=true
|
||||
shift ;;
|
||||
--hcc)
|
||||
build_hip_clang=false
|
||||
shift ;;
|
||||
--hip-clang)
|
||||
build_hip_clang=true
|
||||
shift ;;
|
||||
--no_clean)
|
||||
clean_build=false
|
||||
shift ;;
|
||||
--prefix)
|
||||
install_prefix=${2}
|
||||
shift 2 ;;
|
||||
@@ -112,10 +122,12 @@ check_exit_code( )
|
||||
# prep
|
||||
# #################################################
|
||||
# ensure a clean build environment
|
||||
if [[ "${build_release}" == true ]]; then
|
||||
rm -rf build/release
|
||||
else
|
||||
rm -rf build/debug
|
||||
if ($clean_build); then
|
||||
if [[ "${build_release}" == true ]]; then
|
||||
rm -rf build/release
|
||||
else
|
||||
rm -rf build/debug
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
@@ -156,7 +168,7 @@ if ($install_dependencies); then
|
||||
fi
|
||||
check_exit_code "$?"
|
||||
|
||||
if ($build_tests); then
|
||||
if ($build_tests) || (($run_tests) && [[ ! -f ./test/UnitTests ]]); then
|
||||
CXX=$rocm_path/$compiler $cmake_executable $cmake_common_options -DBUILD_TESTS=ON -DCMAKE_INSTALL_PREFIX=$install_prefix ../../.
|
||||
else
|
||||
CXX=$rocm_path/$compiler $cmake_executable $cmake_common_options -DBUILD_TESTS=OFF -DCMAKE_INSTALL_PREFIX=$install_prefix ../../.
|
||||
@@ -178,7 +190,11 @@ fi
|
||||
# Optionally, run tests if they're enabled.
|
||||
if ($run_tests); then
|
||||
if (test -f "./test/UnitTests"); then
|
||||
./test/UnitTests
|
||||
if ($run_tests_all); then
|
||||
./test/UnitTests
|
||||
else
|
||||
./test/UnitTests --gtest_filter="BroadcastCorrectnessSweep*:*float32*"
|
||||
fi
|
||||
else
|
||||
echo "Unit tests have not been built yet; please re-run script with -t to build unit tests."
|
||||
exit 1
|
||||
|
||||
@@ -170,6 +170,51 @@ namespace CorrectnessTests
|
||||
// - Each test is instantiated with a different TestTuple
|
||||
class CorrectnessTest : public testing::TestWithParam<TestTuple>
|
||||
{
|
||||
public:
|
||||
struct PrintToStringParamName
|
||||
{
|
||||
std::string operator()(const testing::TestParamInfo<CorrectnessTest::ParamType>& info)
|
||||
{
|
||||
std::string name;
|
||||
|
||||
name += opStrings[std::get<0>(info.param)] + "_";
|
||||
name += dataTypeStrings[std::get<1>(info.param)] + "_";
|
||||
name += std::to_string(std::get<2>(info.param)) + "elements_";
|
||||
name += std::to_string(std::get<3>(info.param)) + "devices_";
|
||||
name += std::get<4>(info.param) == true ? "inplace_" : "outofplace_";
|
||||
std::string envVars = std::string(std::get<5>(info.param));
|
||||
std::replace(envVars.begin(), envVars.end(), '=', '_');
|
||||
name += envVars;
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
std::map<ncclRedOp_t, std::string> opStrings
|
||||
{
|
||||
{ncclSum, "sum"},
|
||||
{ncclProd, "prod"},
|
||||
{ncclMax, "max"},
|
||||
{ncclMin, "min"}
|
||||
};
|
||||
|
||||
std::map<ncclDataType_t, std::string> dataTypeStrings
|
||||
{
|
||||
{ncclInt8, "int8"},
|
||||
{ncclChar, "char"},
|
||||
{ncclUint8, "uint8"},
|
||||
{ncclInt32, "int32"},
|
||||
{ncclInt, "int"},
|
||||
{ncclUint32, "uint32"},
|
||||
{ncclInt64, "int64"},
|
||||
{ncclUint64, "uint64"},
|
||||
{ncclFloat16, "float16"},
|
||||
{ncclHalf, "half"},
|
||||
{ncclFloat32, "float32"},
|
||||
{ncclFloat64, "float64"},
|
||||
{ncclDouble, "double"},
|
||||
{ncclBfloat16, "bfloat16"}
|
||||
};
|
||||
};
|
||||
protected:
|
||||
|
||||
// This code is called per test-tuple
|
||||
|
||||
@@ -88,7 +88,7 @@ namespace CorrectnessTests
|
||||
}
|
||||
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(AllGatherCorrectnessSweep,
|
||||
INSTANTIATE_TEST_SUITE_P(AllGatherCorrectnessSweep,
|
||||
AllGatherCorrectnessTest,
|
||||
testing::Combine(
|
||||
// Reduction operator (not used)
|
||||
@@ -110,5 +110,6 @@ namespace CorrectnessTests
|
||||
testing::Values(2,3,4,5,6,7,8),
|
||||
// In-place or not
|
||||
testing::Values(false, true),
|
||||
testing::Values("")));
|
||||
testing::Values("")),
|
||||
CorrectnessTest::PrintToStringParamName());
|
||||
} // namespace
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace CorrectnessTests
|
||||
dataset.Release();
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(AllReduceCorrectnessSweep,
|
||||
INSTANTIATE_TEST_SUITE_P(AllReduceCorrectnessSweep,
|
||||
AllReduceCorrectnessTest,
|
||||
testing::Combine(
|
||||
// Reduction operator
|
||||
@@ -58,5 +58,6 @@ namespace CorrectnessTests
|
||||
testing::Values(2,3,4,5,6,7,8),
|
||||
// In-place or not
|
||||
testing::Values(false, true),
|
||||
testing::Values("")));
|
||||
testing::Values("")),
|
||||
CorrectnessTest::PrintToStringParamName());
|
||||
} // namespace
|
||||
|
||||
@@ -126,7 +126,7 @@ namespace CorrectnessTests
|
||||
dataset.Release();
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(AllReduceAbortSweep,
|
||||
INSTANTIATE_TEST_SUITE_P(AllReduceAbortSweep,
|
||||
AllReduceAbortTest,
|
||||
testing::Combine(
|
||||
// Reduction operator
|
||||
@@ -139,5 +139,6 @@ namespace CorrectnessTests
|
||||
testing::Values(2, 4),
|
||||
// In-place or not
|
||||
testing::Values(false),
|
||||
testing::Values("")));
|
||||
testing::Values("")),
|
||||
CorrectnessTest::PrintToStringParamName());
|
||||
} // namespace
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace CorrectnessTests
|
||||
dataset.Release();
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(AllToAllCorrectnessSweep,
|
||||
INSTANTIATE_TEST_SUITE_P(AllToAllCorrectnessSweep,
|
||||
AllToAllCorrectnessTest,
|
||||
testing::Combine(
|
||||
// Reduction operator is not used
|
||||
@@ -62,5 +62,6 @@ namespace CorrectnessTests
|
||||
testing::Values(2,3,4,5,6,7,8),
|
||||
// In-place or not
|
||||
testing::Values(false),
|
||||
testing::Values("RCCL_ALLTOALL_KERNEL_DISABLE=0", "RCCL_ALLTOALL_KERNEL_DISABLE=1")));
|
||||
testing::Values("RCCL_ALLTOALL_KERNEL_DISABLE=0", "RCCL_ALLTOALL_KERNEL_DISABLE=1")),
|
||||
CorrectnessTest::PrintToStringParamName());
|
||||
} // namespace
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace CorrectnessTests
|
||||
dataset.Release();
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(BroadcastCorrectnessSweep,
|
||||
INSTANTIATE_TEST_SUITE_P(BroadcastCorrectnessSweep,
|
||||
BroadcastCorrectnessTest,
|
||||
testing::Combine(
|
||||
// Reduction operator is not used
|
||||
@@ -66,5 +66,6 @@ namespace CorrectnessTests
|
||||
testing::Values(2,3,4,5,6,7,8),
|
||||
// In-place or not
|
||||
testing::Values(false, true),
|
||||
testing::Values("")));
|
||||
testing::Values("")),
|
||||
CorrectnessTest::PrintToStringParamName());
|
||||
} // namespace
|
||||
|
||||
@@ -129,7 +129,7 @@ namespace CorrectnessTests
|
||||
dataset.Release();
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(BroadcastAbortSweep,
|
||||
INSTANTIATE_TEST_SUITE_P(BroadcastAbortSweep,
|
||||
BroadcastAbortTest,
|
||||
testing::Combine(
|
||||
// Reduction operator
|
||||
@@ -142,5 +142,6 @@ namespace CorrectnessTests
|
||||
testing::Values(2, 4),
|
||||
// In-place or not
|
||||
testing::Values(false),
|
||||
testing::Values("")));
|
||||
testing::Values("")),
|
||||
CorrectnessTest::PrintToStringParamName());
|
||||
} // namespace
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace CorrectnessTests
|
||||
}
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(CombinedCallsCorrectnessSweep,
|
||||
INSTANTIATE_TEST_SUITE_P(CombinedCallsCorrectnessSweep,
|
||||
CombinedCallsCorrectnessTest,
|
||||
testing::Combine(
|
||||
// Reduction operator (not used)
|
||||
@@ -96,5 +96,6 @@ namespace CorrectnessTests
|
||||
testing::Values(2,3,4,5,6,7,8),
|
||||
// In-place or not
|
||||
testing::Values(false, true),
|
||||
testing::Values("")));
|
||||
testing::Values("")),
|
||||
CorrectnessTest::PrintToStringParamName());
|
||||
} // namespace
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace CorrectnessTests
|
||||
dataset.Release();
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(GatherCorrectnessSweep,
|
||||
INSTANTIATE_TEST_SUITE_P(GatherCorrectnessSweep,
|
||||
GatherCorrectnessTest,
|
||||
testing::Combine(
|
||||
// Reduction operator is not used
|
||||
@@ -66,5 +66,6 @@ namespace CorrectnessTests
|
||||
testing::Values(2,3,4,5,6,7,8),
|
||||
// In-place or not
|
||||
testing::Values(false),
|
||||
testing::Values("RCCL_ALLTOALL_KERNEL_DISABLE=0", "RCCL_ALLTOALL_KERNEL_DISABLE=1")));
|
||||
testing::Values("RCCL_ALLTOALL_KERNEL_DISABLE=0", "RCCL_ALLTOALL_KERNEL_DISABLE=1")),
|
||||
CorrectnessTest::PrintToStringParamName());
|
||||
} // namespace
|
||||
|
||||
@@ -94,9 +94,9 @@ namespace CorrectnessTests
|
||||
}
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(GroupCallsCorrectnessSweep,
|
||||
GroupCallsCorrectnessTest,
|
||||
testing::Combine(
|
||||
INSTANTIATE_TEST_SUITE_P(GroupCallsCorrectnessSweep,
|
||||
GroupCallsCorrectnessTest,
|
||||
testing::Combine(
|
||||
// Reduction operator (not used)
|
||||
testing::Values(ncclSum),
|
||||
// Data types
|
||||
@@ -116,5 +116,6 @@ namespace CorrectnessTests
|
||||
testing::Values(2,3,4,5,6,7,8),
|
||||
// In-place or not
|
||||
testing::Values(false, true),
|
||||
testing::Values("")));
|
||||
testing::Values("")),
|
||||
CorrectnessTest::PrintToStringParamName());
|
||||
} // namespace
|
||||
|
||||
@@ -44,9 +44,9 @@ namespace CorrectnessTests
|
||||
dataset.Release();
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(ReduceCorrectnessSweep,
|
||||
ReduceCorrectnessTest,
|
||||
testing::Combine(
|
||||
INSTANTIATE_TEST_SUITE_P(ReduceCorrectnessSweep,
|
||||
ReduceCorrectnessTest,
|
||||
testing::Combine(
|
||||
// Reduction operator
|
||||
testing::Values(ncclSum, ncclProd, ncclMax, ncclMin),
|
||||
// Data types
|
||||
@@ -66,5 +66,6 @@ namespace CorrectnessTests
|
||||
testing::Values(2,3,4,5,6,7,8),
|
||||
// In-place or not
|
||||
testing::Values(false, true),
|
||||
testing::Values("")));
|
||||
testing::Values("")),
|
||||
CorrectnessTest::PrintToStringParamName());
|
||||
} // namespace
|
||||
|
||||
@@ -42,9 +42,9 @@ namespace CorrectnessTests
|
||||
dataset.Release();
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(ReduceScatterCorrectnessSweep,
|
||||
ReduceScatterCorrectnessTest,
|
||||
testing::Combine(
|
||||
INSTANTIATE_TEST_SUITE_P(ReduceScatterCorrectnessSweep,
|
||||
ReduceScatterCorrectnessTest,
|
||||
testing::Combine(
|
||||
// Reduction operator
|
||||
testing::Values(ncclSum, ncclProd, ncclMax, ncclMin),
|
||||
// Data types
|
||||
@@ -64,5 +64,6 @@ namespace CorrectnessTests
|
||||
testing::Values(2,3,4,5,6,7,8),
|
||||
// In-place or not
|
||||
testing::Values(false, true),
|
||||
testing::Values("")));
|
||||
testing::Values("")),
|
||||
CorrectnessTest::PrintToStringParamName());
|
||||
} // namespace
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace CorrectnessTests
|
||||
dataset.Release();
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(ScatterCorrectnessSweep,
|
||||
INSTANTIATE_TEST_SUITE_P(ScatterCorrectnessSweep,
|
||||
ScatterCorrectnessTest,
|
||||
testing::Combine(
|
||||
// Reduction operator is not used
|
||||
@@ -66,5 +66,6 @@ namespace CorrectnessTests
|
||||
testing::Values(2,3,4,5,6,7,8),
|
||||
// In-place or not
|
||||
testing::Values(false),
|
||||
testing::Values("RCCL_ALLTOALL_KERNEL_DISABLE=0", "RCCL_ALLTOALL_KERNEL_DISABLE=1")));
|
||||
testing::Values("RCCL_ALLTOALL_KERNEL_DISABLE=0", "RCCL_ALLTOALL_KERNEL_DISABLE=1")),
|
||||
CorrectnessTest::PrintToStringParamName());
|
||||
} // namespace
|
||||
|
||||
Ссылка в новой задаче
Block a user