Skip to content

Commit

Permalink
Merge pull request #8 from erizmr/5_upgrade_movement
Browse files Browse the repository at this point in the history
Update Movement and set up CI test workflow
  • Loading branch information
erizmr authored Sep 12, 2024
2 parents aa0ea6b + c0d823c commit 0a27351
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 46 deletions.
33 changes: 20 additions & 13 deletions .github/workflows/test_warpmesh.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ on:
branches:
- main

pull_request:

jobs:
test-warpmesh:
name: Test WarpMesh
Expand All @@ -14,24 +16,29 @@ jobs:
options: --user root
steps:
- uses: actions/checkout@v3
- name: Install movement
- name: Install Movement
run: |
git clone https://github.com/pyroteus/movement.git
. /home/firedrake/firedrake/bin/activate
git clone https://github.com/mesh-adaptation/movement.git
cd movement
pip install -e .
- name: Install warpmesh
python3 -m pip install -e .
- name: Install PyTorch
run: |
. /home/firedrake/firedrake/bin/activate
pwd
pip install -e .
- name: install warpmesh dependencies
python3 -m pip install torch --index-url https://download.pytorch.org/whl/cpu
- name: Install PyTorch3d
run: |
. /home/firedrake/firedrake/bin/activate
pip install -r requirements.txt
- name: test warpmesh
python3 -m pip install 'git+https://github.com/facebookresearch/pytorch3d.git'
- name: Install other WarpMesh dependencies
run: |
. /home/firedrake/firedrake/bin/activate
cd ./tests
python -m pytest ./test* -v
python3 -m pip install -r requirements.txt
- name: Install WarpMesh
run: |
. /home/firedrake/firedrake/bin/activate
python3 -m pip install -e .
- name: Run WarpMesh test suite
run: |
. /home/firedrake/firedrake/bin/activate
python3 -m pytest tests/test* -v
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[submodule "install/movement"]
path = install/movement
url = https://github.com/pyroteus/movement.git
url = https://github.com/mesh-adaptation/movement.git

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ Just navigate to **project root** folder, open terminaland execute the `install/
sh ./install/install.sh
```

This will install [firedrake](https://www.firedrakeproject.org/download.html) and [movement](https://github.com/pyroteus/movement) under `install` folder, as well as the `WarpMesh` package.
This will install [firedrake](https://www.firedrakeproject.org/download.html) and [movement](https://github.com/mesh-adaptation/movement) under `install` folder, as well as the `WarpMesh` package.


### The hard way (in case the easy way did not went well or you want to challenge yourself):

1. The mesh generation relies on firedrake, which is a python package. To install firedrake, please follow the instructions on [firedrakeproject.org](https://www.firedrakeproject.org/download.html).

2. The movement of the mesh is implemented by `pyroteus/movement`, install it in the firedrake venv. To install, run `pip install -e .` in the `pyroteus/movement` directory. Here is a link to that repo: [pyroteus/movement](https://github.com/pyroteus/movement).
2. The movement of the mesh is implemented by `mesh-adaptation/movement`, install it in the firedrake venv. To install, run `pip install -e .` in the `mesh-adaptation/movement` directory. Here is a link to that repo: [mesh-adaptation/movement](https://github.com/mesh-adaptation/movement).

3. Use the venv provided by firedrake to install the dependencies of this project. The venv is located at `~/firedrakevenv/bin/activate`. To activate the venv, run `source ~/firedrakevenv/bin/activate`. Then run `pip install -r requirements.txt` to install the dependencies.

Expand Down
45 changes: 20 additions & 25 deletions install/install.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,59 +2,54 @@

# This script will install necessary packages for the project

function yellow_log(){
local DATE_N=`date "+%Y-%m-%d %H:%M:%S"`
function yellow_log() {
local DATE_N=$(date "+%Y-%m-%d %H:%M:%S")
local color="\033[33m"
echo -e "$DATE_N$color $* \033[0m"
}

function green_log(){
local DATE_N=`date "+%Y-%m-%d %H:%M:%S"`
function green_log() {
local DATE_N=$(date "+%Y-%m-%d %H:%M:%S")
local color="\033[32m"
echo -e "$DATE_N$color $* \033[0m"
}

yellow_log "Please deactivate conda enviroment before running this script, otherwise it will fail."

# Download pyroteus/movement package.
green_log "Start downloading movement..."
# Download mesh-adaptation/movement package.
green_log "Start downloading Movement..."

if [ -d ./install/movement ]
then
yellow_log "movement dir exists, abort downloading"
if [ -d ./install/movement ]; then
yellow_log "Movement dir exists, abort downloading"
fi

if [ ! -d ./install/movement ]
then
yellow_log "movement does not exist, start downloading movement"
git submodule add https://github.com/pyroteus/movement.git install/movement
if [ ! -d ./install/movement ]; then
yellow_log "Movement does not exist, start downloading Movement"
git submodule add https://github.com/mesh-adaptation/movement.git install/movement
fi


# Download & install firedrake
cd ./install

# If previous file exists
if [ -d ./firedrake ]
then
green_log "The directory has existed, nothing to be done"
if [ -d ./firedrake ]; then
green_log "The directory has existed, nothing to be done"
fi

if [ ! -d ./firedrake ]
then
curl -O https://raw.githubusercontent.com/firedrakeproject/firedrake/master/scripts/firedrake-install
python3 firedrake-install --disable-ssh
green_log "firedrake has been installed"
if [ ! -d ./firedrake ]; then
curl -O https://raw.githubusercontent.com/firedrakeproject/firedrake/master/scripts/firedrake-install
python3 firedrake-install --disable-ssh
green_log "Firedrake has been installed"
fi

# activate firedrake enviroment
# Activate Firedrake enviroment
. ./firedrake/bin/activate

# Install movement
# Install Movement
cd movement
pip install -e .

# Install warpmesh
# Install WarpMesh
cd ../..
pip install -r requirements.txt
pip install -e .
11 changes: 6 additions & 5 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
numpy >= 1.13.0
numpy
pandas
meshio
matplotlib
Expand All @@ -7,9 +7,10 @@ pytest
pytest-timeout
jupyter
ipython
torch == 1.13.1
torch_geometric == 2.5.3
torch_sparse == 0.6.18
seaborn
torch
torch_geometric
torch_sparse
tensorboardX
torch_scatter
rich
Expand All @@ -18,4 +19,4 @@ ipython
pep8
sphinx
einops
gmsh
gmsh

0 comments on commit 0a27351

Please sign in to comment.