Customizing PhysicsNeMo#
To contribute to the PhysicsNeMo framework, use a fork for your development. The Contribution Guide provides the steps needed for opening a pull request. This guide covers the steps needed to test your developments locally.
To start customizing PhysicsNeMo, install it in editable mode. This allows you to make changes to the source code without reinstalling PhysicsNeMo every time you make a change. The following instructions apply whether you use Docker or pip (virtual environment) methods. Docker is preferred as it comes with pre-installed dependencies.
Uninstall the existing PhysicsNeMo installation:
pip uninstall -y nvidia-physicsnemo nvidia-physicsnemo.sym
Clone the relevant PhysicsNeMo repositories and install the source code in editable mode. The following instructions show the steps for the core physicsnemo package:
git clone https://github.com/NVIDIA/physicsnemo.git
cd physicsnemo/
pip install -e .
The editable install now allows you to make changes to the source files from the physicsnemo
directory. Changes are immediately available without requiring reinstallation.
If you have developments that you want to contribute back to the PhysicsNeMo repositories, follow the typical GitHub Contribution workflow. Refer to the PhysicsNeMo Contribution Guidelines for more details.
Testing the Developments#
Always test your developments locally before submitting code. While the Contribution Guides discuss this process in detail, the following instructions provide a complete overview. To install PhysicsNeMo with all development packages (including packages like pytest
, black
, interrogate
, and others that are part of the CI/CD system):
git clone https://github.com/NVIDIA/physicsnemo.git
cd physicsnemo/
pip install -e .[dev]
Then run the tests using:
cd test/
pytest
Verify that you produce output similar to:
================================= test session starts ==================================
platform linux -- Python 3.10.6, pytest-7.4.0, pluggy-1.2.0
rootdir: /examples/
plugins: hydra-core-1.3.2, shard-0.1.2, rerunfailures-12.0, xdist-3.3.1, xdoctest-1.0.2, hypothesis-5.35.1, flakefinder-1.1.0
collected 591 items
Running 591 items in this shard
test_multi_gpu_sample.py s [ 0%]
datapipes/test_ahmed_body.py ss [ 0%]
datapipes/test_climate_hdf5.py sssssssssssssssssssssssssss [ 5%]
datapipes/test_darcy.py sssssssssssssssss [ 7%]
datapipes/test_era5_hdf5.py sssssssssssssssssssssssssss [ 12%]
datapipes/test_kelvin_helmholtz.py sssssssssssssssssssssssssssss [ 17%]
datapipes/sfno/test_data_loader_dummy.py . [ 17%]
deploy/test_onnx_fft.py ......................................................... [ 27%]
................... [ 30%]
deploy/test_onnx_utils.py .... [ 31%]
distributed/test_autograd.py ssss [ 31%]
distributed/test_manager.py .....s [ 32%]
distributed/test_utils.py . [ 32%]
metrics/test_metrics_climate.py ...... [ 34%]
metrics/test_metrics_general.py ............ [ 36%]
models/test_afno.py .......... [ 37%]
models/test_dlwp.py ......................................................... [ 47%]
models/test_entrypoints.py ......... [ 48%]
models/test_fcn_mip_plugin.py ssssssss [ 50%]
models/test_fno.py .................................. [ 56%]
models/test_from_torch.py .......... [ 57%]
models/test_fully_connected.py .......... [ 59%]
models/test_layers_activations.py ....... [ 60%]
models/test_layers_weightnorm.py .. [ 60%]
models/test_model_factory.py .. [ 61%]
models/test_nd_conv_layers.py .............. [ 63%]
models/test_pix2pix.py .............. [ 65%]
models/test_rnn.py ............................ [ 70%]
models/test_rnn_layers.py ....................................................... [ 80%]
................. [ 82%]
models/test_super_res_net.py .......... [ 84%]
models/graphcast/test_concat_trick.py . [ 84%]
models/graphcast/test_cugraphops.py . [ 84%]
models/graphcast/test_grad_checkpointing.py .. [ 85%]
models/graphcast/test_graphcast.py .......... [ 86%]
models/meshgraphnet/test_meshgraphnet.py .......... [ 88%]
models/sfno/test_activations.py .... [ 89%]
models/sfno/test_sfno.py ................ [ 92%]
utils/test_capture.py .................................. [ 97%]
utils/test_filesystem.py .. [ 98%]
utils/graphcast/test_coordinate_transform.py ... [ 98%]
utils/graphcast/test_loss.py . [ 98%]
utils/sfno/test_img_utils.py .. [ 99%]
utils/sfno/test_logging.py . [ 99%]
utils/sfno/test_warmup_scheduler.py . [ 99%]
utils/sfno/test_yparams.py ... [100%]
================================== warnings summary ====================================
============== 475 passed, 116 skipped, 28 warnings in 134.51s (0:02:14) ===============
Note
This is just an example of what information is shown. Test failures are not necessarily indicative of a broken PhysicsNeMo installation.