-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathMakefile
More file actions
104 lines (80 loc) · 3.2 KB
/
Copy pathMakefile
File metadata and controls
104 lines (80 loc) · 3.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
PIP := $(shell command -v pip3 2> /dev/null || command which pip 2> /dev/null)
PYTHON := $(shell command -v python3 2> /dev/null || command which python 2> /dev/null)
NUM_PROCESSES = 4
.PHONY: install dev-install dev-install_nccl install_ \
conda install_conda_nccl dev-install_conda dev-install_conda_nccl \
tests tests_nccl doc doc_cupy doc_nccl docupdate \
run_examples run_tutorials run_tutorials_cupy run_tutorials_nccl
pipcheck:
ifndef PIP
$(error "Ensure pip or pip3 are in your PATH")
endif
@echo Using pip: $(PIP)
pythoncheck:
ifndef PYTHON
$(error "Ensure python or python3 are in your PATH")
endif
@echo Using python: $(PYTHON)
install:
make pipcheck
$(PIP) install -r requirements.txt && $(PIP) install .
dev-install:
make pipcheck
$(PIP) install -r requirements-dev.txt && $(PIP) install -e .
dev-install_nccl:
make pipcheck
$(PIP) install -r requirements-dev.txt && $(PIP) install cupy-cuda12x nvidia-nccl-cu12 && $(PIP) install -e .
install_conda:
conda env create -f environment.yml && conda activate pylops_mpi && pip install .
install_conda_nccl:
conda env create -f environment.yml && conda activate pylops_mpi && conda install -c conda-forge cupy nccl && pip install .
dev-install_conda:
conda env create -f environment-dev.yml && conda activate pylops_mpi && pip install -e .
dev-install_conda_nccl:
conda env create -f environment-dev.yml && conda activate pylops_mpi && conda install -c conda-forge cupy nccl && pip install -e .
dev-install_fft:
make pipcheck
$(PIP) install -r requirements-dev.txt && $(PIP) install -e ".[fft]"
lint:
flake8 pylops_mpi/ tests/ examples/ tutorials/
tests:
export TEST_CUPY_PYLOPS=0 && mpiexec -n $(NUM_PROCESSES) pytest tests/ --with-mpi
# assuming NUM_PROCESSES <= number of gpus available
tests_gpu:
export TEST_CUPY_PYLOPS=1 && mpiexec -n $(NUM_PROCESSES) pytest tests/ --with-mpi
# assuming NUM_PROCESSES <= number of gpus available
tests_nccl:
mpiexec -n $(NUM_PROCESSES) pytest tests_nccl/ --with-mpi
# sphinx-build does not work well with NCCL
doc:
cd docs && rm -rf source/api/generated && rm -rf source/gallery &&\
rm -rf source/tutorials && rm -rf build &&\
cd .. && NCCL_PYLOPS_MPI=0 sphinx-build -b html docs/source docs/build
doc_cupy:
cp tutorials_cupy/* tutorials/
cd docs && rm -rf source/api/generated && rm -rf source/gallery &&\
rm -rf source/tutorials && rm -rf build &&\
cd .. && sphinx-build -b html docs/source docs/build &&\
rm tutorials/*_cupy.py
doc_nccl:
cp tutorials_cupy/* tutorials_nccl/* tutorials/
cd docs && rm -rf source/api/generated && rm -rf source/gallery &&\
rm -rf source/tutorials && rm -rf build &&\
cd .. && sphinx-build -b html docs/source docs/build &&\
rm tutorials/*_cupy.py tutorials/*_nccl.py
docupdate:
cd docs && NCCL_PYLOPS_MPI=0 make html && cd ..
servedoc:
$(PYTHON) -m http.server --directory docs/build/html/
# Run examples using mpi
run_examples:
sh mpi_examples.sh examples $(NUM_PROCESSES)
# Run tutorials using mpi
run_tutorials:
sh mpi_examples.sh tutorials $(NUM_PROCESSES)
# Run tutorials using mpi with cupy arrays
run_tutorials_cupy:
sh mpi_examples.sh tutorials_cupy $(NUM_PROCESSES)
# Run tutorials using nccl
run_tutorials_nccl:
sh mpi_examples.sh tutorials_nccl $(NUM_PROCESSES)