Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

Commit

Permalink
Replace the term "sanity", which is non-inclusive.
Browse files Browse the repository at this point in the history
"sanity", which has denotative (e.g. primary) meaning of "basic tests", also
has negative connotations (e.g. secondary meanings) relating to mental health.
The use of the term "sanity check" may suggest that individuals with mental
illnesses are inferior, wrong, or incorrect.

In accordance with the Thrust code of conduct, we should strive to
avoid non-inclusive terms like "sanity" and use neutral and inclusive language
instead:

https://github.com/NVIDIA/thrust/blob/main/CODE_OF_CONDUCT.md

The term "sanity" is listed as a non-inclusive term to avoid by a number of
technical and standards organizations:

W3C: https://w3c.github.io/manual-of-style/#inclusive
IETF: https://github.com/ietf/terminology
Google Engineering: https://developers.google.com/style/inclusive-documentation
Twitter Engineering
INCITS (US national standards)
ISO (international standards)
  • Loading branch information
brycelelbach committed Dec 18, 2020
1 parent b829f4a commit d781f42
Show file tree
Hide file tree
Showing 11 changed files with 99 additions and 100 deletions.
1 change: 1 addition & 0 deletions cmake/filecheck_confidence_test
@@ -0,0 +1 @@
CONFIDENCE
1 change: 0 additions & 1 deletion cmake/sanity

This file was deleted.

4 changes: 2 additions & 2 deletions examples/CMakeLists.txt
Expand Up @@ -28,8 +28,8 @@ if (THRUST_ENABLE_EXAMPLE_FILECHECK)
endif()

execute_process(
COMMAND "${THRUST_FILECHECK_EXECUTABLE}" "${filecheck_data_path}/thrust.sanity.filecheck"
INPUT_FILE "${Thrust_SOURCE_DIR}/cmake/sanity"
COMMAND "${THRUST_FILECHECK_EXECUTABLE}" "${filecheck_data_path}/thrust.confidence.filecheck"
INPUT_FILE "${Thrust_SOURCE_DIR}/cmake/filecheck_confidence_test"
RESULT_VARIABLE exit_code
)

Expand Down
8 changes: 3 additions & 5 deletions examples/sparse_vector.cu
Expand Up @@ -11,7 +11,6 @@ template <typename IndexVector,
void print_sparse_vector(const IndexVector& A_index,
const ValueVector& A_value)
{
// sanity test
assert(A_index.size() == A_value.size());

for(size_t i = 0; i < A_index.size(); i++)
Expand All @@ -35,7 +34,6 @@ void sum_sparse_vectors(const IndexVector1& A_index,
typedef typename IndexVector3::value_type IndexType;
typedef typename ValueVector3::value_type ValueType;

// sanity test
assert(A_index.size() == A_value.size());
assert(B_index.size() == B_value.size());

Expand All @@ -53,7 +51,7 @@ void sum_sparse_vectors(const IndexVector1& A_index,
B_value.begin(),
temp_index.begin(),
temp_value.begin());

// compute number of unique indices
size_t C_size = thrust::inner_product(temp_index.begin(), temp_index.end() - 1,
temp_index.begin() + 1,
Expand Down Expand Up @@ -83,7 +81,7 @@ int main(void)
A_index[1] = 3; A_value[1] = 60;
A_index[2] = 5; A_value[2] = 20;
A_index[3] = 8; A_value[3] = 40;

// initialize sparse vector B with 6 elements
thrust::device_vector<int> B_index(6);
thrust::device_vector<float> B_value(6);
Expand All @@ -97,7 +95,7 @@ int main(void)
// compute sparse vector C = A + B
thrust::device_vector<int> C_index;
thrust::device_vector<float> C_value;

sum_sparse_vectors(A_index, A_value, B_index, B_value, C_index, C_value);

std::cout << "Computing C = A + B for sparse vectors A and B" << std::endl;
Expand Down
1 change: 1 addition & 0 deletions internal/test/thrust.confidence.filecheck
@@ -0,0 +1 @@
CHECK: CONFIDENCE
1 change: 0 additions & 1 deletion internal/test/thrust.sanity.filecheck

This file was deleted.

23 changes: 12 additions & 11 deletions internal/test/thrust_nightly.pl
Expand Up @@ -182,12 +182,12 @@ sub process_return_code {

my $have_filecheck = 1;

sub filecheck_sanity {
my $filecheck_cmd = "$filecheck_path/FileCheck $filecheck_data_path/thrust.sanity.filecheck";
sub filecheck_test {
my $filecheck_cmd = "$filecheck_path/FileCheck $filecheck_data_path/thrust.confidence.filecheck";

my $filecheck_pid = open(my $filecheck_stdin, "|-", "$filecheck_cmd 2>&1");

print $filecheck_stdin "SANITY";
print $filecheck_stdin "CONFIDENCE";

my $filecheck_ret = 0;
if (close($filecheck_stdin) == 0)
Expand All @@ -196,21 +196,21 @@ sub filecheck_sanity {
}

if ($filecheck_ret == 0) {
printf("#### SANE FileCheck\n");
printf("&&&& PASSED FileCheck\n");
} else {
# Use a temporary file to send the output to
# FileCheck so we can get the output this time,
# because Perl and bidirectional pipes suck.
my $tmp = File::Temp->new();
my $tmp_filename = $tmp->filename;
print $tmp "SANITY";
print $tmp "CONFIDENCE";

printf("********************************************************************************\n");
print `$filecheck_cmd -input-file $tmp_filename`;
printf("********************************************************************************\n");

process_return_code("FileCheck Sanity", $filecheck_ret, "");
printf("#### INSANE FileCheck\n");
process_return_code("FileCheck Test", $filecheck_ret, "");
printf("&&&& FAILED FileCheck\n");

$have_filecheck = 0;
}
Expand Down Expand Up @@ -243,7 +243,7 @@ sub run_cmd {
{
$ret = $?;
}

alarm 0;
};
my $elapsed = timestamp() - $start;
Expand Down Expand Up @@ -286,7 +286,7 @@ sub run_examples {
{
my $test_exe = $test;

# Ignore FileCheck files.
# Ignore FileCheck files.
if ($test =~ /[.]filecheck$/)
{
next;
Expand Down Expand Up @@ -403,7 +403,7 @@ sub run_unit_tests {
{
my $test_exe = $test;

# Ignore FileCheck files.
# Ignore FileCheck files.
if ($test =~ /[.]filecheck$/)
{
next;
Expand Down Expand Up @@ -558,6 +558,7 @@ sub dvs_summary {

printf("\n");

# We can't remove "sanity" here yet because DVS looks for this exact string.
printf("CUDA DVS BASIC SANITY SCORE : %.1f\n", $dvs_score);

if ($failures + $errors > 0) {
Expand All @@ -582,7 +583,7 @@ sub dvs_summary {

printf("\n");

filecheck_sanity();
filecheck_test();

printf("\n");

Expand Down
40 changes: 20 additions & 20 deletions testing/unittest/cuda/testframework.cu
Expand Up @@ -29,15 +29,15 @@ void list_devices(void)
{
std::cout << "There is no device supporting CUDA" << std::endl;
}

int selected_device;
cudaGetDevice(&selected_device);

for (int dev = 0; dev < deviceCount; ++dev)
{
cudaDeviceProp deviceProp;
cudaGetDeviceProperties(&deviceProp, dev);

if(dev == 0)
{
if(deviceProp.major == 9999 && deviceProp.minor == 9999)
Expand All @@ -47,12 +47,12 @@ void list_devices(void)
else
std::cout << "There are " << deviceCount << " devices supporting CUDA" << std:: endl;
}

std::cout << "\nDevice " << dev << ": \"" << deviceProp.name << "\"";
if(dev == selected_device)
std::cout << " [SELECTED]";
std::cout << std::endl;

std::cout << " Major revision number: " << deviceProp.major << std::endl;
std::cout << " Minor revision number: " << deviceProp.minor << std::endl;
std::cout << " Total amount of global memory: " << deviceProp.totalGlobalMem << " bytes" << std::endl;
Expand All @@ -70,16 +70,16 @@ template<typename Iterator> Iterator my_next(Iterator iter)
std::vector<int> CUDATestDriver::target_devices(const ArgumentMap &kwargs)
{
std::vector<int> result;

// by default, test all devices in the system (device id -1)
int device_id = kwargs.count("device") ? atoi(kwargs.find("device")->second.c_str()) : -1;

if(device_id < 0)
{
// target all devices in the system
int count = 0;
cudaGetDeviceCount(&count);

result.resize(count);
std::iota(result.begin(), result.end(), 0);
}
Expand All @@ -88,7 +88,7 @@ std::vector<int> CUDATestDriver::target_devices(const ArgumentMap &kwargs)
// target the specified device
result = std::vector<int>(1,device_id);
}

return result;
}

Expand All @@ -105,12 +105,12 @@ bool CUDATestDriver::check_cuda_error(bool concise)
<< std::string(cudaGetErrorString(error))
<< "]" << std::endl;
}
}
}

return cudaSuccess != error;
}

bool CUDATestDriver::post_test_sanity_check(const UnitTest &test, bool concise)
bool CUDATestDriver::post_test_confidence_check(const UnitTest &test, bool concise)
{
cudaError_t const error = cudaDeviceSynchronize();
if(cudaSuccess != error)
Expand All @@ -127,7 +127,7 @@ bool CUDATestDriver::post_test_sanity_check(const UnitTest &test, bool concise)

return cudaSuccess == error;
}

bool CUDATestDriver::run_tests(const ArgumentSet &args, const ArgumentMap &kwargs)
{
bool verbose = kwargs.count("verbose");
Expand All @@ -142,17 +142,17 @@ bool CUDATestDriver::run_tests(const ArgumentSet &args, const ArgumentMap &kwarg

// check error status before doing anything
if(check_cuda_error(concise)) return false;

bool result = true;

if(kwargs.count("verbose"))
{
list_devices();
}

// figure out which devices to target
std::vector<int> devices = target_devices(kwargs);

// target each device
for(std::vector<int>::iterator device = devices.begin();
device != devices.end();
Expand All @@ -170,7 +170,7 @@ bool CUDATestDriver::run_tests(const ArgumentSet &args, const ArgumentMap &kwarg
// note which device we're skipping
cudaDeviceProp deviceProp;
cudaGetDeviceProperties(&deviceProp, *device);

std::cout << "Skipping Device " << *device << ": \"" << deviceProp.name << "\"" << std::endl;

continue;
Expand All @@ -181,23 +181,23 @@ bool CUDATestDriver::run_tests(const ArgumentSet &args, const ArgumentMap &kwarg
// note which device we're testing
cudaDeviceProp deviceProp;
cudaGetDeviceProperties(&deviceProp, *device);

std::cout << "Testing Device " << *device << ": \"" << deviceProp.name << "\"" << std::endl;
}

// check error status before running any tests
if(check_cuda_error(concise)) return false;

// run tests
result &= UnitTestDriver::run_tests(args, kwargs);

if(!concise && my_next(device) != devices.end())
{
// provide some separation between the output of separate tests
std::cout << std::endl;
}
}

return result;
}

Expand Down
2 changes: 1 addition & 1 deletion testing/unittest/cuda/testframework.h
Expand Up @@ -16,7 +16,7 @@ class CUDATestDriver

bool check_cuda_error(bool concise);

virtual bool post_test_sanity_check(const UnitTest &test, bool concise);
virtual bool post_test_confidence_check(const UnitTest &test, bool concise);

virtual bool run_tests(const ArgumentSet &args, const ArgumentMap &kwargs);
};
Expand Down

0 comments on commit d781f42

Please sign in to comment.