Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
linuxbin
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Aerospace and Mechanical Engineering
linuxbin
Commits
38b65817
Commit
38b65817
authored
4 years ago
by
Boman Romain
Browse files
Options
Downloads
Patches
Plain Diff
add python3 option
parent
93820cd2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
comp.py
+32
-13
32 additions, 13 deletions
comp.py
prmClasses.py
+2
-2
2 additions, 2 deletions
prmClasses.py
with
34 additions
and
15 deletions
comp.py
+
32
−
13
View file @
38b65817
...
...
@@ -83,11 +83,13 @@ class CompJob(ParametricJob):
TextPRM
(
self
.
pars
,
'
CMAKELIST
'
,
'
build options
'
,
"
%s.cmake
"
%
machineName
)
YesNoPRM
(
self
.
pars
,
'
DEBUG_MODE
'
,
'
debug mode
'
,
False
)
TextPRM
(
self
.
pars
,
'
PYTHONEXE
'
,
'
Python executable
'
,
sys
.
executable
)
TextPRM
(
self
.
pars
,
'
NICE_VALUE
'
,
'
nice value
'
,
"
0
"
)
TextPRM
(
self
.
pars
,
'
NB_TASKS
'
,
'
nb of tasks launched in parallel
'
,
"
1
"
)
TextPRM
(
self
.
pars
,
'
NB_THREADS
'
,
'
nb of threads by task
'
,
"
1
"
)
YesNoPRM
(
self
.
pars
,
'
GIT_FULLCLONE
'
,
'
clone the whole repository
'
,
False
)
YesNoPRM
(
self
.
pars
,
'
GIT_FULLCLONE
'
,
'
clone the whole repository
'
,
False
)
TextPRM
(
self
.
pars
,
'
GIT_DEPTH
'
,
'
git clone depth
'
,
'
10
'
)
TextPRM
(
self
.
pars
,
'
GIT_BRANCH
'
,
'
git branch name
'
,
'
master
'
)
...
...
@@ -102,12 +104,13 @@ class CompJob(ParametricJob):
PRMAction
(
self
.
actions
,
'
b
'
,
self
.
pars
[
'
ARC_NAME
'
])
PRMAction
(
self
.
actions
,
'
c
'
,
self
.
pars
[
'
CMAKELIST
'
])
PRMAction
(
self
.
actions
,
'
d
'
,
self
.
pars
[
'
DEBUG_MODE
'
])
PRMAction
(
self
.
actions
,
'
e
'
,
self
.
pars
[
'
PYTHONEXE
'
])
PRMAction
(
self
.
actions
,
'
e
'
,
self
.
pars
[
'
GIT_FULLCLONE
'
])
PRMAction
(
self
.
actions
,
'
f
'
,
self
.
pars
[
'
GIT_DEPTH
'
])
PRMAction
(
self
.
actions
,
'
g
'
,
self
.
pars
[
'
GIT_BRANCH
'
])
PRMAction
(
self
.
actions
,
'
f
'
,
self
.
pars
[
'
GIT_FULLCLONE
'
])
PRMAction
(
self
.
actions
,
'
g
'
,
self
.
pars
[
'
GIT_DEPTH
'
])
PRMAction
(
self
.
actions
,
'
h
'
,
self
.
pars
[
'
GIT_BRANCH
'
])
PRMAction
(
self
.
actions
,
'
h
'
,
self
.
pars
[
'
NICE_VALUE
'
])
PRMAction
(
self
.
actions
,
'
i
'
,
self
.
pars
[
'
NICE_VALUE
'
])
PRMAction
(
self
.
actions
,
'
j
'
,
self
.
pars
[
'
NB_TASKS
'
])
PRMAction
(
self
.
actions
,
'
k
'
,
self
.
pars
[
'
NB_THREADS
'
])
...
...
@@ -193,7 +196,7 @@ class CompJob(ParametricJob):
exe
=
'
bin/Metafor
'
dflag
=
''
if
self
.
pars
[
'
DEBUG_MODE
'
].
val
:
dflag
=
'
-D
CMAKE_BUILD_TYPE=Debug
'
dflag
=
'
-DCMAKE_BUILD_TYPE=Debug
'
# first check
if
not
os
.
path
.
isdir
(
'
oo_meta
'
):
self
.
error
(
'
oo_meta not here!
'
)
...
...
@@ -203,6 +206,20 @@ class CompJob(ParametricJob):
shutil
.
rmtree
(
'
oo_metaB
'
)
os
.
mkdir
(
'
oo_metaB
'
)
os
.
chdir
(
'
oo_metaB
'
)
# which python?
out
=
subprocess
.
check_output
([
self
.
pars
[
'
PYTHONEXE
'
].
val
,
'
-c
'
,
'
from __future__ import print_function; import sys; print(sys.version_info.major)
'
])
try
:
pyver
=
int
(
out
)
except
:
self
.
error
(
'
unable to get python version number
'
)
print
(
'
Python version is
'
,
pyver
)
if
pyver
==
2
:
pyflag
=
'
-DMETAFOR_USE_PY3=OFF
'
else
:
pyflag
=
'
-DMETAFOR_USE_PY3=ON
'
# configure
print
(
"
configuring oo_meta
"
)
cmfile
=
'
../oo_meta/CMake/%s
'
%
self
.
pars
[
'
CMAKELIST
'
].
val
...
...
@@ -211,8 +228,8 @@ class CompJob(ParametricJob):
msg
=
'
%s not found!
'
%
cmfile
print
(
msg
)
self
.
mailmsg
(
msg
)
cmd
=
'
cmake -C %s %s ../oo_meta >autocf.log 2>&1
'
%
(
cmfile
,
dflag
)
#
print cmd
cmd
=
'
cmake -C %s %s
%s
../oo_meta >autocf.log 2>&1
'
%
(
cmfile
,
pyflag
,
dflag
)
print
(
cmd
)
os
.
system
(
cmd
)
# compile
ncpu
=
int
(
self
.
pars
[
'
NB_TASKS
'
].
val
)
*
int
(
self
.
pars
[
'
NB_THREADS
'
].
val
)
...
...
@@ -234,14 +251,16 @@ class CompJob(ParametricJob):
def
cleanBattery
(
self
):
os
.
chdir
(
'
oo_metaB/bin
'
)
print
(
"
cleaning old results
"
)
os
.
system
(
"
python
battery.py clean >/dev/null 2>&1
"
)
os
.
system
(
"
%s
battery.py clean >/dev/null 2>&1
"
%
self
.
pars
[
'
PYTHONEXE
'
].
val
)
os
.
chdir
(
'
../..
'
)
def
startBat
(
self
):
now
=
datetime
.
datetime
.
now
()
print
(
"
starting battery at %s (come back tomorrow)
"
%
now
.
ctime
())
os
.
chdir
(
'
oo_metaB/bin
'
)
cmd
=
"
nice -%s python battery.py -j %s -k %s >battery.log 2>&1
"
%
(
self
.
pars
[
'
NICE_VALUE
'
].
val
,
self
.
pars
[
'
NB_TASKS
'
].
val
,
self
.
pars
[
'
NB_THREADS
'
].
val
)
cmd
=
"
nice -%s %s battery.py -j %s -k %s >battery.log 2>&1
"
%
\
(
self
.
pars
[
'
NICE_VALUE
'
].
val
,
self
.
pars
[
'
PYTHONEXE
'
].
val
,
\
self
.
pars
[
'
NB_TASKS
'
].
val
,
self
.
pars
[
'
NB_THREADS
'
].
val
)
p
=
subprocess
.
Popen
(
cmd
,
shell
=
True
)
p
.
wait
()
# finish script
...
...
@@ -252,9 +271,9 @@ class CompJob(ParametricJob):
def
checkResults
(
self
):
# pars indep
os
.
chdir
(
'
oo_metaB/bin
'
)
print
(
"
diff
'
ing results
"
)
cmd
=
"
python
battery.py diff
"
print
(
"
checkResults: cmd = %s
"
%
cmd
)
print
(
"
diff
'
ing results
"
)
cmd
=
"
%s
battery.py diff
"
%
self
.
pars
[
'
PYTHONEXE
'
].
val
print
(
"
checkResults: cmd = %s
"
%
cmd
)
os
.
system
(
cmd
)
file
=
'
verif/%s-diffs.html
'
%
machineid
()
print
(
"
verif file name = %s
"
%
file
)
...
...
This diff is collapsed.
Click to expand it.
prmClasses.py
+
2
−
2
View file @
38b65817
...
...
@@ -35,7 +35,7 @@ class PRMSet(object):
self
.
debug
=
_verb
def
printPars
(
self
):
for
par
in
self
.
pars
.
values
():
for
par
in
list
(
self
.
pars
.
values
()
)
:
par
.
writePRM
(
sys
.
stdout
)
def
loadPaths
(
self
):
...
...
@@ -49,7 +49,7 @@ class PRMSet(object):
pth
=
self
.
savePath
()
fname
=
os
.
path
.
join
(
pth
,
self
.
cfgfile
)
file
=
open
(
fname
,
"
w
"
)
for
par
in
self
.
pars
.
values
():
for
par
in
list
(
self
.
pars
.
values
()
)
:
par
.
writePRM
(
file
)
file
.
close
()
...
...
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
register
or
sign in
to comment