Skip to content
Snippets Groups Projects
Commit 5ec6bbca authored by Matthew Webster's avatar Matthew Webster
Browse files

BF: Compilation must occur in output directory

parent 0ea71f16
No related branches found
No related tags found
1 merge request!69Bf/startup
Pipeline #25787 skipped
...@@ -4,10 +4,13 @@ ...@@ -4,10 +4,13 @@
import os import os
import shlex import shlex
import sys
import tempfile import tempfile
import subprocess as sp import subprocess as sp
from pathlib import Path
def run(cmd, ompthreads=None, blasthreads=None, fslskipglobal=None): def run(cmd, ompthreads=None, blasthreads=None, fslskipglobal=None):
env = os.environ.copy() env = os.environ.copy()
...@@ -33,12 +36,23 @@ def run(cmd, ompthreads=None, blasthreads=None, fslskipglobal=None): ...@@ -33,12 +36,23 @@ def run(cmd, ompthreads=None, blasthreads=None, fslskipglobal=None):
def main(): def main():
env = os.environ.copy()
activatePath = Path(f'''{env['FSLDIR']}/bin/activate''')
print(f'''active {activatePath}''')
if not activatePath.is_file():
activatePath='activate'
buildcmds = ['source activate $FSLDIR', outdir = Path(sys.argv[1])
buildcmds = [f'''source {activatePath} $FSLDIR''',
'source $FSLDIR/etc/fslconf/fsl-devel.sh', 'source $FSLDIR/etc/fslconf/fsl-devel.sh',
f'''cp Makefile test_fslStartup.cc {outdir}''',
f'''cd {outdir}''',
'make'] 'make']
sp.run('; '.join(buildcmds), check=True, shell=True) sp.run('; '.join(buildcmds), check=True, shell=True)
os.chdir(outdir)
# Default behaviour should be: OMP multi-threaded, BLAS single threaded. # Default behaviour should be: OMP multi-threaded, BLAS single threaded.
assert run('./test_fslStartup', 8, 8) == '8 1 8' assert run('./test_fslStartup', 8, 8) == '8 1 8'
assert run('./test_fslStartup', 4, 4) == '4 1 4' assert run('./test_fslStartup', 4, 4) == '4 1 4'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment