Last active
October 2, 2020 13:24
-
-
Save tai271828/02fd83ed477be3cfef8ad86117a1d720 to your computer and use it in GitHub Desktop.
Prepare SOLVCON development environment
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# source me | |
# | |
# activate conda | |
export SCSRC="${HOME}/work-my-projects/solvcon/solvcon" | |
export SCSRC_MODMESH="${HOME}/work-my-projects/solvcon/modmesh" | |
export SCSRC_WORKING="${HOME}/work-my-projects/solvcon/solvcon-working" | |
export MODMESH_INSTALLED="${SCSRC_WORKING}/venv-conda-modmesh" | |
export PATH="${SCSRC_WORKING}/miniconda/bin:$PATH" | |
# include SCSRC into general paths | |
export PATH=$SCSRC_MODMESH:$SCSRC:$PATH | |
# activate virtual environment created by this conda | |
# | |
# you may use "conda env list" to recall which virtual environments were | |
# created by this conda | |
source activate ${SCSRC_WORKING}/venv-conda-modmesh | |
set -x | |
PYTHON_VERSION_FULL=`python --version | awk {'print $2'}` | |
PYTHON_VERSION_SHORT=${PYTHON_VERSION_FULL%.*} | |
export PYTHONPATH=${MODMESH_INSTALLED}/lib/python${PYTHON_VERSION_SHORT}:${SCSRC}:${PYTHONPATH} | |
set +x |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# source me | |
# | |
# activate conda | |
export SCSRC="${HOME}/work-my-projects/solvcon/solvcon" | |
export SCSRC_WORKING="${HOME}/work-my-projects/solvcon/solvcon-working" | |
export PATH="${SCSRC_WORKING}/miniconda/bin:$PATH" | |
# include SCSRC into general paths | |
export PATH=$SCSRC:$PATH | |
# TODO: | |
# To know where to find libmarch.so | |
# Remove me after Makefile of SOLVCON is fixed to install the .so in the | |
# expected virtual environment. | |
export PYTHONPATH=$SCSRC:$PYTHONPATH | |
# activate virtual environment created by this conda | |
# | |
# you may use "conda env list" to recall which virtual environments were | |
# created by this conda | |
source activate ${SCSRC_WORKING}/venv-conda | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# You need to install prepare-solvcon-dev.sh first | |
# | |
# Usage: | |
# source <this script> | |
# or | |
# source <this script> <your-project-folder> | |
# | |
set -x | |
SOLVCON_PROJECT=${1:-${HOME}/work-my-projects/solvcon} | |
SCSRC="${SOLVCON_PROJECT}/solvcon" | |
SCSRC_MODMESH="${SOLVCON_PROJECT}/modmesh" | |
SCSRC_WORKING="${SOLVCON_PROJECT}/solvcon-working" | |
MINICONDA_DIR="${SCSRC_WORKING}/miniconda" | |
export PATH="${SCSRC}:${MINICONDA_DIR}/bin/:${PATH}" | |
mkdir -p ${SCSRC_WORKING} | |
# fetch SOLVCON source | |
git clone [email protected]:solvcon/modmesh.git ${SCSRC_MODMESH} | |
# create virtual env by conda | |
conda create -p ${SCSRC_WORKING}/venv-conda-modmesh --no-default-packages -y python | |
# you need to source this script to make the following line effective | |
source ./activate-solvcon-dev-modmesh.sh | |
set +x | |
# build modmesh | |
pip install pytest numpy setuptools pytest flake8 | |
pushd ${SCSRC_MODMESH} | |
python setup.py build_ext --cmake-args="-DCMAKE_BUILD_TYPE=Release" --make-args="VERBOSE=1" | |
python setup.py install | |
popd | |
# test the build | |
pushd ${SCSRC_MODMESH}/tests | |
pytest | |
popd |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Usage: | |
# source <this script> | |
# or | |
# source <this script> <your-project-folder> | |
# | |
set -x | |
SOLVCON_PROJECT=${1:-${HOME}/work-my-projects/solvcon} | |
SCSRC="${SOLVCON_PROJECT}/solvcon" | |
SCSRC_WORKING="${SOLVCON_PROJECT}/solvcon-working" | |
MINICONDA_DIR="${SCSRC_WORKING}/miniconda" | |
export PATH="${SCSRC}:${MINICONDA_DIR}/bin:${PATH}" | |
mkdir -p ${SCSRC_WORKING} | |
# fetch SOLVCON source | |
git clone [email protected]:solvcon/solvcon.git ${SCSRC} | |
# prepare miniconda | |
# please note contrib/conda.sh will use python 3.6 if you want to install | |
# paraview with this conda 3.6 python, this issue may happen to you github | |
# https://github.com/conda-forge/paraview-feedstock/issues/27 by using 3.8 | |
# python conda this issue is resolved by the recompiled paraview package and | |
# the corresponding libraries | |
# | |
# install paraview via conda-forge: | |
# conda install -c conda-forge paraview | |
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ${SCSRC_WORKING}/miniconda.sh | |
bash ${SCSRC_WORKING}/miniconda.sh -b -p ${MINICONDA_DIR} | |
conda config --set always_yes yes | |
conda update -q conda | |
# create virtual env by conda | |
conda create -p ${SCSRC_WORKING}/venv-conda --no-default-packages -y python | |
source activate ${SCSRC_WORKING}/venv-conda | |
set +x | |
# prepare all packages to build SOLVCON | |
${SCSRC}/contrib/conda.sh | |
${SCSRC}/contrib/build-pybind11-in-conda.sh | |
pushd ${SCSRC} | |
# make libmarch.so and SOLVCON | |
make | |
make install | |
# test built SOLVCON | |
nosetests --with-doctest | |
nosetests ftests/gasplus/* | |
popd | |
echo "=======================================" | |
echo "Completed unit tests and function tests" | |
echo "=======================================" | |
echo "=======================================" | |
echo "Start to run Sod tube test" | |
echo "=======================================" | |
# basic example | |
pushd ${SCSRC}/sandbox/gas/tube | |
./go run | |
popd | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment