Skip to content
This repository has been archived by the owner on Apr 23, 2021. It is now read-only.

WIP: Add internal wrappers #32

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 45 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,32 @@
# You can set these variables from the command line.
SIMPHONYENV ?= ~/simphony
SIMPHONYVERSION ?= 0.1.3
HAVE_NUMERRIN ?= no

.PHONY: clean base apt-openfoam apt-simphony apt-lammps apt-mayavi fix-pip simphony-env lammps jyu-lb simphony simphony-lammps simphony-mayavi simphony-openfoam simphony-jyu-lb test-plugins test-framework
ifeq ($(HAVE_NUMERRIN),yes)
TEST_NUMERRIN_COMMAND=(cd src/simphony-numerrin; LD_LIBRARY_PATH=../../lib haas numerrin_wrapper -v)
else
TEST_NUMERRIN_COMMAND=@echo "skip NUMERRIN tests"
endif


.PHONY: clean base apt-openfoam apt-simphony apt-lammps apt-numerrin apt-mayavi fix-pip simphony-env lammps jyu-lb simphony simphony-lammps simphony-numerrin simphony-mayavi simphony-openfoam simphony-jyu-lb test-plugins test-framework

help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " base to install essential packages (requires sudo)"
@echo " apt-openfoam to install openfoam 2.2.2 (requires sudo)"
@echo " apt-simphony to install building depedencies for the simphony library (requires sudo)"
@echo " apt-lammps to install building depedencies for the lammps solver (requires sudo)"
@echo " apt-numerrin to install numerrin (requires sudo)"
@echo " apt-mayavi to install building depedencies for the mayavi (requires sudo)"
@echo " fix-pip to update the version of pip and virtual evn (requires sudo)"
@echo " simphony-env to create a simphony virtualenv"
@echo " lammps to build and install the lammps solver"
@echo " jyu-lb to build and install the JYU-LB solver"
@echo " simphony to build and install the simphony library"
@echo " simphony-lammps to build and install the simphony-lammps plugin"
@echo " simphony-numerrin to build and install the simphony-numerrin plugin"
@echo " simphony-mayavi to build and install the simphony-mayavi plugin"
@echo " simphony-openfoam to build and install the simphony-mayavi plugin"
@echo " simphony-jyu-lb to build and install the simphony-jyu-lb plugin"
Expand All @@ -32,6 +42,11 @@ clean:
rm -Rf src/lammps
rm -Rf src/JYU-LB
rm -Rf src/simphony-openfoam
rm -Rf src/simphony-jyulb
rm -Rf src/simphony-numerrin
rm -rf lib/liblammps.so
rm -rf lib/libnumerrin4.so
rm -rf lib/numerrin.so
@echo
@echo "Removed temporary folders"

Expand Down Expand Up @@ -66,6 +81,15 @@ apt-mayavi:
@echo
@echo "Build dependencies for mayavi installed"

apt-numerrin:
rm -Rf src/simphony-numerrin
git clone --branch 0.1.0 https://github.com/simphony/simphony-numerrin.git src/simphony-numerrin
cp src/simphony-numerrin/numerrin-interface/libnumerrin4.so lib/.
rm -Rf src/simphony-numerrin
@echo
@echo "Numerrin installed"
@echo "(Ensure that environment variable PYNUMERRIN_LICENSE points to license file)"

fix-pip:
wget https://raw.github.com/pypa/pip/master/contrib/get-pip.py
python get-pip.py
Expand All @@ -87,15 +111,18 @@ lammps:
git clone --branch r12824 --depth 1 git://git.lammps.org/lammps-ro.git src/lammps
$(MAKE) -C src/lammps/src ubuntu_simple -j 2
cp src/lammps/src/lmp_ubuntu_simple $(SIMPHONYENV)/bin/lammps
$(MAKE) -C src/lammps/src makeshlib -j 2
$(MAKE) -C src/lammps/src ubuntu_simple -f Makefile.shlib -j 2
(mkdir lib; cd src/lammps/python; python install.py ../../../lib $(SIMPHONYENV)/lib/python2.7/site-packages/)
rm -Rf src/lammps
@echo
@echo "Lammps solver installed"

jyu-lb:
rm -Rf src/JYU-LB
git clone --branch 0.1.0 https://github.com/simphony/JYU-LB.git src/JYU-LB
git clone --branch master https://github.com/simphony/JYU-LB.git src/JYU-LB
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should always checkout a tag of a stable release. master is not a safe choice

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, agree. simphony-jyulb 0.1.2 fails with JYU-LB 0.1.0. I have created an issue at simphony/simphony-jyulb#22

$(MAKE) -C src/JYU-LB -j 2
cp src/JYU-LB/bin/jyu_lb_isothermal3D.exe $(SIMPHONYENV)/bin/jyu_lb_isothermal3D.exe
cp src/JYU-LB/bin/jyu_lb_isothermal.exe $(SIMPHONYENV)/bin/jyu_lb_isothermal.exe
rm -Rf src/JYU-LB
@echo
@echo "jyu-lb solver installed"
Expand All @@ -112,6 +139,14 @@ simphony-mayavi:
@echo
@echo "Simphony Mayavi plugin installed"

simphony-numerrin:
rm -Rf src/simphony-numerrin
git clone --branch 0.1.0 https://github.com/simphony/simphony-numerrin.git src/simphony-numerrin
cp src/simphony-numerrin/numerrin-interface/numerrin.so $(SIMPHONYENV)/lib/python2.7/site-packages/
(cd src/simphony-numerrin; python setup.py develop)
@echo
@echo "Simphony Numerrin plugin installed"

simphony-openfoam:
pip install --upgrade svn+https://svn.code.sf.net/p/openfoam-extend/svn/trunk/Breeder/other/scripting/PyFoam#egg=PyFoam
rm -Rf src/simphony-openfoam
Expand All @@ -123,12 +158,15 @@ simphony-openfoam:
@echo "Simphony OpenFoam plugin installed"

simphony-jyu-lb:
pip install --upgrade git+https://github.com/simphony/simphony-jyulb.git@0.1.1#egg=jyu_engine
rm -Rf src/simphony-jyulb
git clone --branch 0.1.2 --depth 1 https://github.com/simphony/simphony-jyulb.git src/simphony-jyulb
git clone --branch master https://github.com/simphony/JYU-LB.git src/simphony-jyulb/JYU-LB
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not be necessary. ``make jyu-lb` should install the necessary files correct?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in version 0.1.2 of simphony-jyulb, it is now required that jyulb repository be in its directory before running setup.py. there is an issue related to it at simphony/simphony-jyulb#21

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

commonly one can pass the path of the header files when calling setup.py. something like.

python setup.py build_ext -I <include directory> -L <library directory> install

(cd src/simphony-jyulb; python setup.py develop)
@echo
@echo "Simphony jyu-lb plugin installed"

simphony-lammps:
pip install --upgrade git+https://github.com/simphony/simphony-lammps-md.git@0.1.2#egg=simlammps
pip install --upgrade git+https://github.com/simphony/simphony-lammps-md.git@0.1.3#egg=simlammps
@echo
@echo "Simphony lammps plugin installed"

Expand All @@ -144,9 +182,10 @@ test-plugins:
pip install haas
haas simphony -v
haas jyulb -v
haas simlammps -v
LD_LIBRARY_PATH=./lib/:$LD_LIBRARY_PATH haas simlammps -v
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm... if simlammps now requires dynamic libraries then these could be copied to the virtual-env lib directory (similar to what we do for copying the executables to the bin directory. I think that should work

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried that way with no luck.

It would rule if lammps.py did something like this: https://github.com/ldx/python-iptables/blob/master/iptc/util.py#L55-64

haas simphony_mayavi -v
(cd src/simphony-openfoam; haas foam_controlwrapper -v)
$(TEST_NUMERRIN_COMMAND)
@echo
@echo "Tests for the simphony plugins done"

Expand Down
6 changes: 6 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ are:
- https://github.com/simphony/simphony-jyulb/releases/tag/0.1.1, version 0.1.1
- https://github.com/simphony/simphony-lammps-md/releases/tag/0.1.2, version 0.1.2
- https://github.com/simphony/simphony-openfoam/releases/tag/0.1.1, version 0.1.1
- https://github.com/simphony/simphony-numerrin/releases/tag/0.1.0, version 0.1.0
- https://github.com/simphony/simphony-mayavi/releases/tag/0.1.1, version 0.1.1


Expand Down Expand Up @@ -76,6 +77,7 @@ various apt repositories, and require ``sudo`` access::
sudo apt-simphony
sudo apt-lammps
sudo apt-mayavi
sudo apt-numerrin


.. note::
Expand All @@ -84,6 +86,10 @@ various apt repositories, and require ``sudo`` access::
please activate the related environment::

source /opt/openfoam222/etc/bashrc

The ``apt-numerrin`` target will install nummerin library. To use this solver, please
ensure that environment variable PYNUMERRIN_LICENSE points to Numerrin license file.




Expand Down
8 changes: 7 additions & 1 deletion tests/test_engine_import.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
import unittest
import importlib
import os

ENGINES = [
'lammps',
'openfoam',
'jyulb']

if os.getenv("HAVE_NUMERRIN", "no") == "yes":
ENGINES.append("numerrin")


class TestEngineImport(unittest.TestCase):

def test_engine_import(self):
for engine in ENGINES:
importlib.import_module('simphony.engine',engine)
print engine
importlib.import_module('simphony.engine', engine)