Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TurTLE
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TurTLE
TurTLE
Commits
bced0c3a
Commit
bced0c3a
authored
Jul 20, 2015
by
Cristian Lalescu
Browse files
Options
Downloads
Patches
Plain Diff
compilation works with installed package
parent
c00c01d8
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
bfps/__init__.py
+5
-0
5 additions, 0 deletions
bfps/__init__.py
bfps/code.py
+25
-6
25 additions, 6 deletions
bfps/code.py
with
30 additions
and
6 deletions
bfps/__init__.py
+
5
−
0
View file @
bced0c3a
...
...
@@ -31,11 +31,16 @@ try:
if
not
here
.
startswith
(
os
.
path
.
join
(
dist_loc
,
'
bfps
'
)):
# not installed, but there is another version that *is*
raise
DistributionNotFound
header_dir
=
_dist
.
location
lib_dir
=
header_dir
except
DistributionNotFound
:
#__version__ = 'Please install this project with setup.py'
import
subprocess
__version__
=
'
git revision
'
+
subprocess
.
check_output
([
'
git
'
,
'
rev-parse
'
,
'
HEAD
'
]).
strip
()
header_dir
=
'
./src
'
lib_dir
=
'
./lib
'
else
:
__version__
=
_dist
.
version
from
.code
import
code
This diff is collapsed.
Click to expand it.
bfps/code.py
+
25
−
6
View file @
bced0c3a
...
...
@@ -83,7 +83,7 @@ class code(base):
"""
return
None
def
write_src
(
self
):
with
open
(
'
src/
'
+
self
.
name
+
'
.cpp
'
,
'
w
'
)
as
outfile
:
with
open
(
self
.
name
+
'
.cpp
'
,
'
w
'
)
as
outfile
:
outfile
.
write
(
self
.
version_message
)
outfile
.
write
(
self
.
includes
)
outfile
.
write
(
self
.
variables
)
...
...
@@ -92,15 +92,34 @@ class code(base):
outfile
.
write
(
self
.
main
)
outfile
.
write
(
self
.
main_end
)
return
None
def
compile_code
(
self
):
# compile code
local_install_dir
=
'
/scratch.local/chichi/installs
'
include_dirs
=
[
bfps
.
header_dir
,
'
/usr/lib64/mpi/gcc/openmpi/include
'
,
os
.
path
.
join
(
local_install_dir
,
'
include
'
)]
libraries
=
[
'
fftw3_mpi
'
,
'
fftw3
'
,
'
fftw3f_mpi
'
,
'
fftw3f
'
,
'
bfps
'
]
command_strings
=
[
'
mpicxx
'
]
for
idir
in
include_dirs
:
command_strings
+=
[
'
-I{0}
'
.
format
(
idir
)]
command_strings
+=
[
'
-L
'
+
os
.
path
.
join
(
local_install_dir
,
'
lib
'
)]
command_strings
.
append
(
'
-L
'
+
bfps
.
lib_dir
)
for
libname
in
libraries
:
command_strings
+=
[
'
-l
'
+
libname
]
command_strings
+=
[
self
.
name
+
'
.cpp
'
,
'
-o
'
,
self
.
name
]
print
command_strings
# print sum(command_strings)
return
subprocess
.
call
(
command_strings
)
def
run
(
self
,
ncpu
=
2
,
simname
=
'
test
'
,
iter0
=
0
):
# compile code and run
if
subprocess
.
call
([
'
make
'
,
'
-f
'
,
'
~/repos/bfps/makefile
'
,
self
.
name
+
'
.elf
'
])
==
0
:
if
self
.
compile_code
():
current_dir
=
os
.
getcwd
()
if
not
os
.
path
.
isdir
(
self
.
work_dir
):
os
.
mkdir
(
self
.
work_dir
)
...
...
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment