Skip to content
Snippets Groups Projects
Commit 06b382e5 authored by Cristian Lalescu's avatar Cristian Lalescu
Browse files

use more polite installation of machine_settings

parent 1f2f2f66
No related branches found
No related tags found
No related merge requests found
......@@ -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')
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment