Skip to content

Commit 96cbdf0

Browse files
committed
tc
1 parent 3cc5eb6 commit 96cbdf0

File tree

1 file changed

+12
-20
lines changed

1 file changed

+12
-20
lines changed

conf.py

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@
3333
sys.path.insert(0, os.path.abspath('./.jenkins'))
3434
import pytorch_sphinx_theme
3535
import torch
36-
import numpy
37-
import gc
3836
import glob
3937
import random
4038
import shutil
@@ -52,8 +50,18 @@
5250
import sphinx_gallery.gen_rst
5351
import multiprocessing
5452

55-
# Monkey patching sphinx gallery to run each example in an isolated process so
56-
# that we don't need to worry about examples changing global state
53+
# Monkey patch sphinx gallery to run each example in an isolated process so that
54+
# we don't need to worry about examples changing global state.
55+
#
56+
# Other option 1: Parallelism was added to sphinx gallery (a later version that
57+
# we are not using yet) using joblib, but it seems to result in errors for us,
58+
# and it has no effect if you set parallel = 1 (it will not put each file run
59+
# into its own process and run singly) so you need parallel >= 2, and there may
60+
# be tutorials that cannot be run in parallel.
61+
#
62+
# Other option 2: Run sphinx gallery once per file (similar to how we shard in
63+
# CI but with shard sizes of 1), but running sphinx gallery for each file has a
64+
# ~5min overhead, resulting in the entire suite taking ~2x time
5765
def call_fn(func, args, kwargs, result_queue):
5866
try:
5967
result = func(*args, **kwargs)
@@ -77,7 +85,6 @@ def wrapper(*args, **kwargs):
7785
raise RuntimeError(f"Error in subprocess: {result}")
7886
return wrapper
7987

80-
# Monkey-patch
8188
sphinx_gallery.gen_rst.generate_file_rst = call_in_subprocess(sphinx_gallery.gen_rst.generate_file_rst)
8289

8390
try:
@@ -128,21 +135,6 @@ def wrapper(*args, **kwargs):
128135

129136
# -- Sphinx-gallery configuration --------------------------------------------
130137

131-
def reset_seeds(gallery_conf, fname):
132-
pass
133-
# torch.cuda.empty_cache()
134-
# torch.backends.cudnn.deterministic = True
135-
# torch.backends.cudnn.benchmark = False
136-
# torch._dynamo.reset()
137-
# torch._inductor.config.force_disable_caches = True
138-
# torch.manual_seed(42)
139-
# torch.set_default_device(None)
140-
# random.seed(10)
141-
# numpy.random.seed(10)
142-
# torch.set_grad_enabled(True)
143-
144-
# gc.collect()
145-
146138
sphinx_gallery_conf = {
147139
'examples_dirs': ['beginner_source', 'intermediate_source',
148140
'advanced_source', 'recipes_source', 'prototype_source'],

0 commit comments

Comments
 (0)