Skip to content

Files

This branch is 28641 commits behind pytorch/pytorch:main.

jit

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Jan 26, 2023
Jan 26, 2023
Sep 25, 2020
Jul 18, 2020
Apr 28, 2021
Apr 28, 2021
May 24, 2021
Apr 18, 2022
Feb 17, 2022
Jul 27, 2022
Oct 27, 2021
Mar 29, 2022
Apr 18, 2022
Apr 9, 2023
Oct 27, 2021
Jul 23, 2021
Oct 19, 2021
Oct 19, 2021
Jul 23, 2021
Jul 23, 2021
Jan 14, 2022
Nov 15, 2021
Jul 23, 2021
Jul 23, 2021
May 25, 2021
Aug 29, 2022
Nov 17, 2022
Aug 29, 2022
Oct 8, 2021
Jul 23, 2021
Feb 12, 2023
Mar 4, 2022
Nov 1, 2022
Jun 11, 2022
Dec 1, 2022
Apr 4, 2022
Oct 27, 2021
Oct 19, 2021
Sep 21, 2021
Nov 5, 2020
Jul 23, 2021
Jun 11, 2022
Nov 23, 2022
Oct 8, 2021
Mar 27, 2023
Jan 20, 2022
Dec 8, 2022
Aug 9, 2022
Jul 23, 2021
Jan 21, 2023
Jan 11, 2022
Dec 4, 2022
Dec 25, 2021
Jul 23, 2021
Jul 23, 2021
Dec 29, 2022
Jul 27, 2022
Aug 30, 2021
May 25, 2021
May 20, 2022
Aug 24, 2021
Jul 23, 2021
Sep 24, 2021
Jul 23, 2021
Oct 8, 2021
Jan 12, 2022
Aug 30, 2021
Apr 18, 2022
Feb 12, 2023
Jun 10, 2022

JIT C++ Tests

Adding a new test

First, create a new test file. Test files should have be placed in this directory, with a name that starts with test_, like test_foo.cpp.

In general a single test suite

Add your test file to the JIT_TEST_SRCS list in test/cpp/jit/CMakeLists.txt.

A test file may look like:

#include <gtest/gtest.h>

using namespace ::torch::jit

TEST(FooTest, BarBaz) {
   // ...
}

// Append '_CUDA' to the test case name will automatically filter it out if CUDA
// is not compiled.
TEST(FooTest, NeedsAGpu_CUDA) {
   // ...
}

// Similarly, if only one GPU is detected, tests with `_MultiCUDA` at the end
// will not be run.
TEST(FooTest, NeedsMultipleGpus_MultiCUDA) {
   // ...
}

Building and running the tests

The following commands assume you are in PyTorch root.

# ... Build PyTorch from source, e.g.
python setup.py develop
# (re)build just the binary
ninja -C build bin/test_jit
# run tests
build/bin/test_jit --gtest_filter='glob_style_filter*'