xref: /aosp_15_r20/external/pytorch/test/cpp/api/README.md (revision da0073e96a02ea20f0ac840b70461e3646d07c45)
1# C++ Frontend Tests
2
3In this folder live the tests for PyTorch's C++ Frontend. They use the
4[GoogleTest](https://github.com/google/googletest) test framework.
5
6## CUDA Tests
7
8To make a test runnable only on platforms with CUDA, you should suffix your
9test with `_CUDA`, e.g.
10
11```cpp
12TEST(MyTestSuite, MyTestCase_CUDA) { }
13```
14
15To make it runnable only on platforms with at least two CUDA machines, suffix
16it with `_MultiCUDA` instead of `_CUDA`, e.g.
17
18```cpp
19TEST(MyTestSuite, MyTestCase_MultiCUDA) { }
20```
21
22There is logic in `main.cpp` that detects the availability and number of CUDA
23devices and supplies the appropriate negative filters to GoogleTest.
24
25## Integration Tests
26
27Integration tests use the MNIST dataset. You must download it by running the
28following command from the PyTorch root folder:
29
30```sh
31$ python tools/download_mnist.py -d test/cpp/api/mnist
32```
33
34The required paths will be referenced as `test/cpp/api/mnist/...` in the test
35code, so you *must* run the integration tests from the PyTorch root folder.
36