From 0587a030f1b6a85f011fc0b774f9eb145aae4226 Mon Sep 17 00:00:00 2001 From: Wei-Tse Hsu Date: Sat, 3 Aug 2024 02:48:39 +0800 Subject: [PATCH 1/7] Minor tweakes for Tutorial 1 --- .circleci/config.yml | 16 ++++++++++------ docs/examples/tutorial_1/standard_REXEE.ipynb | 4 +--- ensemble_md/tests/test_replica_exchange_EE.py | 5 +++++ 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 2c883980..df79fa34 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -56,16 +56,20 @@ jobs: - run: name: Install the ensemble_md package command: | + python3 --version python3 -m pip install --upgrade pip python3 -m pip install . - run: name: Run unit tests + # no_output_timeout: 1h command: | source $HOME/pkgs/bin/GMXRC pip3 install pytest pip3 install pytest-mpi pip3 install pytest-cov + + # sleep 3000 # only for debugging purposes coverage run -m pytest -vv --disable-pytest-warnings --color=yes ensemble_md/tests mpirun -np 4 coverage run --rcfile setup.cfg -m pytest ensemble_md/tests/test_mpi_func.py --with-mpi -vv --disable-pytest-warnings --color=yes # this will generate multiple .coverage* files that can be combined @@ -94,9 +98,9 @@ workflows: # - test: # name: test-python-3.9 # python-version: "3.9" - - test: - name: test-python-3.10 - python-version: "3.10" - - test: - name: test-python-3.11 - python-version: "3.11" + # - test: + # name: test-python-3.10 + # python-version: "3.10" + # - test: + # name: test-python-3.11 + # python-version: "3.11" diff --git a/docs/examples/tutorial_1/standard_REXEE.ipynb b/docs/examples/tutorial_1/standard_REXEE.ipynb index d0395e39..11a7611c 100644 --- a/docs/examples/tutorial_1/standard_REXEE.ipynb +++ b/docs/examples/tutorial_1/standard_REXEE.ipynb @@ -13,7 +13,7 @@ "id": "48c42ec7", "metadata": {}, "source": [ - "[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/wehs7661/ensemble_md/c0f6d48ce3fe746e349e4a4a9610f935cca8b0b5?urlpath=lab%2Ftree%2Fdocs%2Fexamples%2Ftutorial_1%2Frun_REXEE.ipynb)\n", + "[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/wehs7661/ensemble_md.git/HEAD?labpath=docs%2Fexamples%2Ftutorial_1%2Fstandard_REXEE.ipynb)\n", "\n", "In this tutorial, we will demonstrate how one can use the different command-line interfaces (CLIs) implemented in the Python package `ensemble_md` to prepare, perform, and analyze a REXEE simulation to estimate the solvation free energy of a toy molecule composed of 4 interaction sites. For a more comprehensive understanding, we strongly recommend reading our [documentation](https://ensemble-md.readthedocs.io/en/latest/simulations.html) on launching REXEE simulations before starting this tutorial. For the theory behind the REXEE method, we recommend reading our [JCTC paper](https://pubs.acs.org/doi/10.1021/acs.jctc.1c00494) or the [theory section](https://ensemble-md.readthedocs.io/en/add_tutorials/theory.html) of our documentation.\n", "\n", @@ -1093,8 +1093,6 @@ "id": "4378660a-e52c-4fac-acbd-6269b6fe2a1f", "metadata": {}, "source": [ - "
\n", - "\n", "### 4.1. Replica-space sampling\n", "As shown in the replica-space trajectories in the left figure below, each replica was able to sample all different sets of states by exchanging coordinates with other replicas, indicating good sampling in the replica space. This decent sampling in the replica space is also reflected in the replica-space transition matrix in the right figure, where all tridiagonal elements are non-zero. " ] diff --git a/ensemble_md/tests/test_replica_exchange_EE.py b/ensemble_md/tests/test_replica_exchange_EE.py index 61ea5bdf..6a19f7fe 100644 --- a/ensemble_md/tests/test_replica_exchange_EE.py +++ b/ensemble_md/tests/test_replica_exchange_EE.py @@ -25,6 +25,9 @@ from ensemble_md.replica_exchange_EE import ReplicaExchangeEE from ensemble_md.utils.exceptions import ParameterError +import logging +logging.basicConfig(level=logging.DEBUG) + current_path = os.path.dirname(os.path.abspath(__file__)) input_path = os.path.join(current_path, "data") @@ -74,8 +77,10 @@ def check_param_error(REXEE_dict, param, match, wrong_val='cool', right_val=None class Test_ReplicaExchangeEE: def test_init(self, params_dict): + logging.debug("Initializing ReplicaExchangeEE") REXEE = get_REXEE_instance(params_dict) assert REXEE.yaml == 'params.yaml' + logging.debug("Finished initializing ReplicaExchangeEE") def test_set_params_error(self, params_dict): # 1. Required parameters From d6608537488fb9f4024ea72a899a7a18a3593a01 Mon Sep 17 00:00:00 2001 From: Wei-Tse Hsu Date: Sat, 3 Aug 2024 03:12:42 +0800 Subject: [PATCH 2/7] Tweaked config.yaml for CircleCI --- .circleci/config.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index df79fa34..c53cb61c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -4,8 +4,6 @@ jobs: test: docker: - image: cimg/python:<> - environment: - PYTHON_VERSION: "<>" parameters: python-version: type: string @@ -42,6 +40,7 @@ jobs: command: | gcc --version g++ --version + python3 --version export CC=`which gcc` export CXX=`which g++` @@ -56,7 +55,6 @@ jobs: - run: name: Install the ensemble_md package command: | - python3 --version python3 -m pip install --upgrade pip python3 -m pip install . From c5765fb9e38780def98ee3654096a50e1e852f7d Mon Sep 17 00:00:00 2001 From: Wei-Tse Hsu Date: Sat, 3 Aug 2024 03:15:48 +0800 Subject: [PATCH 3/7] Tried switching back to the default machine for CircleCI --- .circleci/config.yml | 111 ++++++++++++++++++++++++------------------- 1 file changed, 61 insertions(+), 50 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index c53cb61c..f9c4d0bc 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,49 +1,45 @@ version: 2.1 -jobs: - test: - docker: - - image: cimg/python:<> +commands: + setup_python: + description: "Install the specified Python version" parameters: python-version: type: string - resource_class: large steps: - - checkout - - run: - name: Show the system information and resource limits + name: Install Python << parameters.python-version >> command: | - uname -a - df -h - ulimit -a + sudo apt-get update + sudo apt-get install -y python<< parameters.python-version >> python<< parameters.python-version >>-pip + python<< parameters.python-version >> -m pip install --upgrade pip + setup_dependencies: + description: "Install dependencies for GROMACS" + steps: - run: - name: Installing dependencies for GROMACS + name: Install dependencies command: | sudo apt-get update - sudo apt-get install -y software-properties-common - sudo apt install build-essential - sudo apt-get install ccache libblas-dev libfftw3-dev liblapack-dev libmpich-dev libxml2-dev mpich ninja-build + sudo apt-get install -y software-properties-common build-essential ccache libblas-dev libfftw3-dev liblapack-dev libmpich-dev libxml2-dev mpich ninja-build wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | sudo tee /etc/apt/trusted.gpg.d/kitware.gpg >/dev/null sudo apt-add-repository 'deb https://apt.kitware.com/ubuntu/ focal main' -y - - # The following three lines are required to install libss1.1, which is not available in the default environment wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_amd64.deb sudo dpkg -i ./libssl1.1_1.1.1f-1ubuntu2_amd64.deb rm -f libssl1.1_1.1.1f-1ubuntu2_amd64.deb - sudo apt install cmake && cmake --version + install_gromacs: + description: "Install the latest version of GROMACS" + steps: - run: - name: Install the latest version of GROMACS + name: Install GROMACS command: | gcc --version g++ --version - python3 --version + python<< parameters.python-version >> --version export CC=`which gcc` export CXX=`which g++` - cd $HOME && mkdir pkgs git clone https://gitlab.com/gromacs/gromacs.git cd gromacs && mkdir build && cd build @@ -52,53 +48,68 @@ jobs: source $HOME/pkgs/bin/GMXRC gmx --version + install_ensemble_md: + description: "Install the ensemble_md package" + steps: - run: - name: Install the ensemble_md package + name: Install ensemble_md command: | - python3 -m pip install --upgrade pip - python3 -m pip install . + python<< parameters.python-version >> -m pip install --upgrade pip + python<< parameters.python-version >> -m pip install . + run_tests: + description: "Run unit tests" + steps: - run: name: Run unit tests - # no_output_timeout: 1h command: | source $HOME/pkgs/bin/GMXRC - pip3 install pytest - pip3 install pytest-mpi - pip3 install pytest-cov - - # sleep 3000 # only for debugging purposes - + python<< parameters.python-version >> -m pip install pytest pytest-mpi pytest-cov coverage run -m pytest -vv --disable-pytest-warnings --color=yes ensemble_md/tests - mpirun -np 4 coverage run --rcfile setup.cfg -m pytest ensemble_md/tests/test_mpi_func.py --with-mpi -vv --disable-pytest-warnings --color=yes # this will generate multiple .coverage* files that can be combined - coverage combine # This will combine multiple .coverage* files into a single .coverage file that will be uploaded and reported. - - # Below are some old commands: - # pytest -vv --disable-pytest-warnings --cov=ensemble_md --cov-report=xml --color=yes ensemble_md/tests/ - # COVERAGE_FILE=.coverage_1 pytest -vv --disable-pytest-warnings --cov=ensemble_md --cov-report=xml --color=yes ensemble_md/tests/ - # COVERAGE_FILE=.coverage_2 mpirun -np 4 pytest -vv --disable-pytest-warnings --cov=ensemble_md --cov-report=xml --color=yes ensemble_md/tests/test_mpi_func.py --with-mpi + mpirun -np 4 coverage run --rcfile setup.cfg -m pytest ensemble_md/tests/test_mpi_func.py --with-mpi -vv --disable-pytest-warnings --color=yes + coverage combine + codecov: + description: "Upload coverage results to CodeCov" + steps: - run: name: CodeCov command: | bash <(curl -s https://codecov.io/bash) - - store_test_results: - path: test-results +jobs: + test: + machine: + image: default + parameters: + python-version: + type: string + resource_class: large + steps: + - checkout + - setup_python: + python-version: << parameters.python-version >> + - setup_dependencies + - install_gromacs: + python-version: << parameters.python-version >> + - install_ensemble_md: + python-version: << parameters.python-version >> + - run_tests: + python-version: << parameters.python-version >> + - codecov -# we are not testing Python 3.12. as it seems to have some conflicts with versioneer.py. Will look into this more in the future. workflows: continuous-integration: jobs: - test: name: test-python-3.8 python-version: "3.8" - # - test: - # name: test-python-3.9 - # python-version: "3.9" - # - test: - # name: test-python-3.10 - # python-version: "3.10" - # - test: - # name: test-python-3.11 - # python-version: "3.11" + - test: + name: test-python-3.9 + python-version: "3.9" + - test: + name: test-python-3.10 + python-version: "3.10" + - test: + name: test-python-3.11 + python-version: "3.11" From e4808fb8772011cedc9d0250ffbea0958469fb7b Mon Sep 17 00:00:00 2001 From: Wei-Tse Hsu Date: Sat, 3 Aug 2024 03:19:20 +0800 Subject: [PATCH 4/7] Tried switching back to the default machine for CircleCI, second attempt --- .circleci/config.yml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index f9c4d0bc..785a5057 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -6,6 +6,7 @@ commands: parameters: python-version: type: string + default: "3.8" steps: - run: name: Install Python << parameters.python-version >> @@ -31,6 +32,10 @@ commands: install_gromacs: description: "Install the latest version of GROMACS" + parameters: + python-version: + type: string + default: "3.8" steps: - run: name: Install GROMACS @@ -50,6 +55,10 @@ commands: install_ensemble_md: description: "Install the ensemble_md package" + parameters: + python-version: + type: string + default: "3.8" steps: - run: name: Install ensemble_md @@ -59,6 +68,10 @@ commands: run_tests: description: "Run unit tests" + parameters: + python-version: + type: string + default: "3.8" steps: - run: name: Run unit tests @@ -80,10 +93,11 @@ commands: jobs: test: machine: - image: default + image: ubuntu-2004:202101-01 parameters: python-version: type: string + default: "3.8" resource_class: large steps: - checkout From fc5c093caf21e99f56ab9a339d8195e0aa8d39f8 Mon Sep 17 00:00:00 2001 From: Wei-Tse Hsu Date: Sat, 3 Aug 2024 03:28:39 +0800 Subject: [PATCH 5/7] Switched back to docker image again but leave out MPI tests --- .circleci/config.yml | 107 +++++++++++++++++-------------------------- 1 file changed, 41 insertions(+), 66 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 785a5057..cb857bda 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,50 +1,49 @@ version: 2.1 -commands: - setup_python: - description: "Install the specified Python version" +jobs: + test: + docker: + - image: cimg/python:<> parameters: python-version: type: string - default: "3.8" + resource_class: large steps: + - checkout + - run: - name: Install Python << parameters.python-version >> + name: Show the system information and resource limits command: | - sudo apt-get update - sudo apt-get install -y python<< parameters.python-version >> python<< parameters.python-version >>-pip - python<< parameters.python-version >> -m pip install --upgrade pip + uname -a + df -h + ulimit -a - setup_dependencies: - description: "Install dependencies for GROMACS" - steps: - run: - name: Install dependencies + name: Installing dependencies for GROMACS command: | sudo apt-get update - sudo apt-get install -y software-properties-common build-essential ccache libblas-dev libfftw3-dev liblapack-dev libmpich-dev libxml2-dev mpich ninja-build + sudo apt-get install -y software-properties-common + sudo apt install build-essential + sudo apt-get install ccache libblas-dev libfftw3-dev liblapack-dev libmpich-dev libxml2-dev mpich ninja-build wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | sudo tee /etc/apt/trusted.gpg.d/kitware.gpg >/dev/null sudo apt-add-repository 'deb https://apt.kitware.com/ubuntu/ focal main' -y + + # The following three lines are required to install libss1.1, which is not available in the default environment wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_amd64.deb sudo dpkg -i ./libssl1.1_1.1.1f-1ubuntu2_amd64.deb rm -f libssl1.1_1.1.1f-1ubuntu2_amd64.deb + sudo apt install cmake && cmake --version - install_gromacs: - description: "Install the latest version of GROMACS" - parameters: - python-version: - type: string - default: "3.8" - steps: - run: - name: Install GROMACS + name: Install the latest version of GROMACS command: | gcc --version g++ --version - python<< parameters.python-version >> --version + python3 --version export CC=`which gcc` export CXX=`which g++` + cd $HOME && mkdir pkgs git clone https://gitlab.com/gromacs/gromacs.git cd gromacs && mkdir build && cd build @@ -53,65 +52,41 @@ commands: source $HOME/pkgs/bin/GMXRC gmx --version - install_ensemble_md: - description: "Install the ensemble_md package" - parameters: - python-version: - type: string - default: "3.8" - steps: - run: - name: Install ensemble_md + name: Install the ensemble_md package command: | - python<< parameters.python-version >> -m pip install --upgrade pip - python<< parameters.python-version >> -m pip install . + python3 -m pip install --upgrade pip + python3 -m pip install . - run_tests: - description: "Run unit tests" - parameters: - python-version: - type: string - default: "3.8" - steps: - run: name: Run unit tests + # no_output_timeout: 1h command: | source $HOME/pkgs/bin/GMXRC - python<< parameters.python-version >> -m pip install pytest pytest-mpi pytest-cov + pip3 install pytest + pip3 install pytest-mpi + pip3 install pytest-cov + + # sleep 3000 # only for debugging purposes + coverage run -m pytest -vv --disable-pytest-warnings --color=yes ensemble_md/tests - mpirun -np 4 coverage run --rcfile setup.cfg -m pytest ensemble_md/tests/test_mpi_func.py --with-mpi -vv --disable-pytest-warnings --color=yes - coverage combine + # mpirun -np 4 coverage run --rcfile setup.cfg -m pytest ensemble_md/tests/test_mpi_func.py --with-mpi -vv --disable-pytest-warnings --color=yes # this will generate multiple .coverage* files that can be combined + # coverage combine # This will combine multiple .coverage* files into a single .coverage file that will be uploaded and reported. + + # Another section of old commands + # pytest -vv --disable-pytest-warnings --cov=ensemble_md --cov-report=xml --color=yes ensemble_md/tests/ + # COVERAGE_FILE=.coverage_1 pytest -vv --disable-pytest-warnings --cov=ensemble_md --cov-report=xml --color=yes ensemble_md/tests/ + # COVERAGE_FILE=.coverage_2 mpirun -np 4 pytest -vv --disable-pytest-warnings --cov=ensemble_md --cov-report=xml --color=yes ensemble_md/tests/test_mpi_func.py --with-mpi - codecov: - description: "Upload coverage results to CodeCov" - steps: - run: name: CodeCov command: | bash <(curl -s https://codecov.io/bash) -jobs: - test: - machine: - image: ubuntu-2004:202101-01 - parameters: - python-version: - type: string - default: "3.8" - resource_class: large - steps: - - checkout - - setup_python: - python-version: << parameters.python-version >> - - setup_dependencies - - install_gromacs: - python-version: << parameters.python-version >> - - install_ensemble_md: - python-version: << parameters.python-version >> - - run_tests: - python-version: << parameters.python-version >> - - codecov + - store_test_results: + path: test-results +# we are not testing Python 3.12. as it seems to have some conflicts with versioneer.py. Will look into this more in the future. workflows: continuous-integration: jobs: From 3f9cd041430302de618cd2660d6ae85269c2b29d Mon Sep 17 00:00:00 2001 From: Wei-Tse Hsu Date: Sat, 3 Aug 2024 14:10:27 +0800 Subject: [PATCH 6/7] Added CI tests based on Python 3.12 --- .circleci/config.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index cb857bda..848965f4 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -40,7 +40,6 @@ jobs: command: | gcc --version g++ --version - python3 --version export CC=`which gcc` export CXX=`which g++` @@ -102,3 +101,6 @@ workflows: - test: name: test-python-3.11 python-version: "3.11" + - test: + name: test-python-3.12 + python-version: "3.12" From 8bcdd9ea48c782647cc697c30d8397bb9b08c313 Mon Sep 17 00:00:00 2001 From: Wei-Tse Hsu Date: Sat, 3 Aug 2024 14:53:15 +0800 Subject: [PATCH 7/7] Remove settings for CI builds based on versions other than Python 3.10 and 3.11 --- .circleci/config.yml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 848965f4..51fa32f0 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -89,18 +89,9 @@ jobs: workflows: continuous-integration: jobs: - - test: - name: test-python-3.8 - python-version: "3.8" - - test: - name: test-python-3.9 - python-version: "3.9" - test: name: test-python-3.10 python-version: "3.10" - test: name: test-python-3.11 python-version: "3.11" - - test: - name: test-python-3.12 - python-version: "3.12"