Commit ebfc89ca authored by Cristian Lalescu's avatar Cristian Lalescu
Browse files

Merge branch 'feature/config' into develop

parents 23e0e6c8 a7ebe198
......@@ -37,14 +37,20 @@ Installation
If you want to run simulations on the machine where you're installing,
you will need to call `build` before installing.
Before executing any command, please modify `machine_settings_py.py`
appropriately for your machine (otherwise the `build` command will most
likely fail).
This file will be copied the first time you run `setup.py` into
`$HOME/.config/bfps/machine_settings.py`, where it will be imported from
afterwards.
You may, obviously, edit it afterwards and rerun the build command as
needed.
.. code:: bash
python setup.py build
python setup.py install
The `build` command will most likely fail unless you modify
`machine_settings.py` appropriately for your machine.
Also, in order to run the C++ code you need to have an MPI compiler
installed, the HDF5 C library as well as FFTW 3 (at least 3.3 I think).
......
......@@ -11,3 +11,4 @@ x 2016-01-07 FFTW interpolator doesn't need its own field
x 2016-01-08 simplify tracer/field addition mechanism @design +v1.0 +particle_api
x 2016-01-08 add stat choice parameter to add_particles @design +v1.0 +particle_api
x 2016-01-15 particle output is broken when niter_part != 1 @bugfix
x 2016-01-19 clean up machine_settings mess @design @documentation +v2.0
......@@ -27,13 +27,17 @@
import os
########################################################################
#### these you're supposed to adapt to your environment
# these lists should be adapted for your different environment(s)
# personally, I have access to setups where my home folder is shared
# between different machines, including cluster and desktop, therefore
# I check the host name when choosing libraries etc.
# feel free to do your own thing to the copy of this file placed in
# ./config/bfps
########################################################################
hostname = os.getenv('HOSTNAME')
extra_compile_args = ['-Wall', '-O2', '-g', '-mtune=native', '-ffast-math', '-std=c++11']
#extra_compile_args = ['-Wall', '-O0', '-g', '-std=c++11']
extra_libraries = ['hdf5']
include_dirs = []
library_dirs = []
......@@ -45,44 +49,6 @@ if hostname == 'chichi-G':
'/usr/lib/mpich']
extra_libraries += ['mpich']
if hostname in ['frontend01', 'frontend02']:
include_dirs = ['/usr/nld/mvapich2-1.9a2-gcc/include',
'/usr/nld/gcc-4.7.2/include',
'/usr/nld/hdf5-1.8.9/include',
'/usr/nld/fftw-3.3.3-mvapich2-1.9a2-gcc/include',
'/usr/nld/fftw-3.3.3-float-mvapich2-1.9a2-gcc/include']
library_dirs = ['/usr/nld/mvapich2-1.9a2-gcc/lib',
'/usr/nld/gcc-4.7.2/lib64',
'/usr/nld/hdf5-1.8.9/lib',
'/usr/nld/fftw-3.3.3-mvapich2-1.9a2-gcc/lib',
'/usr/nld/fftw-3.3.3-float-mvapich2-1.9a2-gcc/lib']
extra_libraries += ['mpich']
extra_compile_args = ['-Wall',
'-O2',
'-g',
'-m64',
'-m80387',
'-mabi=sysv',
'-march=x86-64',
'-masm=intel',
'-masm=att',
'-mfancy-math-387',
'-mfpmath=sse+387',
'-mglibc',
'-mhard-float',
'-mieee-fp',
'-ffast-math',
# '-mlarge-data-threshold=65536',
'-mno-sse4',
'-mpush-args',
'-mred-zone',
'-msse4.2',
'-mstackrealign',
'-mtls-direct-seg-refs',
'-mtune=corei7',
'-std=c++11']
if hostname in ['tolima', 'misti']:
local_install_dir = '/scratch.local/chichi/installs'
......
......@@ -24,20 +24,36 @@
from machine_settings import include_dirs, library_dirs, extra_compile_args, extra_libraries
import pickle
AUTHOR = 'Cristian C Lalescu'
AUTHOR_EMAIL = 'Cristian.Lalescu@ds.mpg.de'
import os
import shutil
import datetime
import sys
import subprocess
from subprocess import CalledProcessError
import pickle
now = datetime.datetime.now()
### compiler configuration
# check if .config/bfps/machine_settings.py file exists, create it if not
homefolder = os.path.expanduser('~')
bfpsfolder = os.path.join(homefolder, '.config/', 'bfps')
if not os.path.exists(os.path.join(bfpsfolder, 'machine_settings.py')):
if not os.path.isdir(bfpsfolder):
os.mkdir(bfpsfolder)
shutil.copyfile('./machine_settings_py.py', os.path.join(bfpsfolder, 'machine_settings.py'))
sys.path.append(bfpsfolder)
# import stuff required for compilation of static library
from machine_settings import include_dirs, library_dirs, extra_compile_args, extra_libraries
### package versioning
# get current time
now = datetime.datetime.now()
# obtain version
try:
git_branch = subprocess.check_output(['git',
'rev-parse',
......@@ -49,7 +65,6 @@ except:
git_revision = ''
git_branch = ''
git_date = now
if git_branch == '':
# there's no git available or something
VERSION = '{0:0>4}{1:0>2}{2:0>2}.{3:0>2}{4:0>2}{5:0>2}'.format(
......@@ -62,9 +77,11 @@ else:
VERSION = subprocess.check_output(['git', 'describe', '--tags']).strip().decode()
else:
VERSION = subprocess.check_output(['git', 'describe', '--tags']).strip().decode().split('-')[0]
print('This is bfps version ' + VERSION)
### lists of files and MANIFEST.in
src_file_list = ['field_descriptor',
'fluid_solver_base',
'fluid_solver',
......@@ -89,13 +106,18 @@ with open('MANIFEST.in', 'w') as manifest_in_file:
for fname in ['bfps/cpp/' + fname + '.cpp' for fname in src_file_list] + header_list:
manifest_in_file.write('include {0}\n'.format(fname))
### libraries
libraries = ['fftw3_mpi',
'fftw3',
'fftw3f_mpi',
'fftw3f']
libraries += extra_libraries
### save compiling information
pickle.dump(
{'include_dirs' : include_dirs,
'library_dirs' : library_dirs,
......@@ -107,6 +129,8 @@ pickle.dump(
open('bfps/install_info.pickle', 'wb'),
protocol = 2)
def compile_bfps_library():
if not os.path.isdir('obj'):
os.makedirs('obj')
......@@ -164,9 +188,9 @@ setup(
packages = ['bfps'],
install_requires = ['numpy>=1.8', 'h5py>=2.2.1'],
cmdclass={'build' : CustomBuild},
package_data = {'bfps': header_list + ['../machine_settings.py',
'libbfps.a',
package_data = {'bfps': header_list + ['libbfps.a',
'install_info.pickle']},
version = VERSION,
########################################################################
# useless stuff folows
########################################################################
......@@ -174,6 +198,5 @@ setup(
long_description = open('README.rst', 'r').read(),
author = AUTHOR,
author_email = AUTHOR_EMAIL,
version = VERSION,
license = 'GPL version 3.0')
......@@ -4,7 +4,6 @@
(B) set up mechanism for adding in new PDEs @design +v2.0 +alternate_algorithms
(B) tweak HDF5 settings @optimization @HDF5 +I/O
(B) use less memory @optimization
(C) clean up machine_settings mess @design @documentation +v2.0
(C) code overview @documentation
(C) move stat I/O to cpp lib @design @HDF5
(C) test involving hydrodynamic similarity @tests
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment