Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
fluiddyn
transonic
Commits
39de205b6590
Commit
20780f30
authored
Nov 30, 2018
by
Pierre Augier
Browse files
Bad fix MPI (to be improved using another package)
--HG-- branch : dev
parent
a2d08a554ff9
Changes
6
Hide whitespace changes
Inline
Side-by-side
CHANGES.rst
View file @
39de205b
...
...
@@ -8,7 +8,7 @@ Future
0.1.2 (?)
---------
- Private command line :code:`
.
pythran-fluid` to call Pythran
- Private command line :code:`
_
pythran-fluid` to call Pythran
- MPI aware (only process rank == 0 doing IO and compilation)
- Fix bug C-style `[][]`
- :code:`Array[float, "2d"]` supported
...
...
fluidpythran/justintime.py
View file @
39de205b
...
...
@@ -336,8 +336,12 @@ class CachedJIT:
if
path_pythran_header
.
exists
():
# get the old signature(s)
with
open
(
path_pythran_header
)
as
file
:
exports_old
=
[
export
.
strip
()
for
export
in
file
.
readlines
()]
exports_old
=
None
if
mpi
.
rank
==
0
:
with
open
(
path_pythran_header
)
as
file
:
exports_old
=
[
export
.
strip
()
for
export
in
file
.
readlines
()]
exports_old
=
mpi
.
bcast
(
exports_old
)
# FIXME: what do we do with the old signatures?
exports
.
update
(
exports_old
)
...
...
@@ -369,8 +373,11 @@ class CachedJIT:
openmp
=
self
.
openmp
,
)
glob_name_ext_file
=
func_name
+
"_"
+
hex_src
+
"_*"
+
ext_suffix
ext_files
=
list
(
path_pythran
.
parent
.
glob
(
glob_name_ext_file
))
ext_files
=
None
if
mpi
.
rank
==
0
:
glob_name_ext_file
=
func_name
+
"_"
+
hex_src
+
"_*"
+
ext_suffix
ext_files
=
list
(
path_pythran
.
parent
.
glob
(
glob_name_ext_file
))
ext_files
=
mpi
.
bcast
(
ext_files
)
if
not
ext_files
:
if
has_to_pythranize_at_import
()
and
_COMPILE_CACHEDJIT
:
...
...
fluidpythran/mpi.py
View file @
39de205b
...
...
@@ -3,23 +3,31 @@
"""
try
:
from
fluiddyn.util
import
mpi
as
_mpi
except
ImportError
:
import
os
if
"__FLUIDPYTHRAN_NO_MPI"
in
os
.
environ
:
nb_proc
=
1
rank
=
0
else
:
try
:
from
mpi4py
import
MPI
from
fluiddyn.util
import
mpi
as
_mpi
except
ImportError
:
nb_proc
=
1
rank
=
0
try
:
from
mpi4py
import
MPI
except
ImportError
:
nb_proc
=
1
rank
=
0
else
:
comm
=
MPI
.
COMM_WORLD
nb_proc
=
comm
.
size
rank
=
comm
.
Get_rank
()
else
:
comm
=
MPI
.
COMM_WORLD
nb_proc
=
comm
.
size
rank
=
comm
.
Get_rank
()
else
:
rank
=
_mpi
.
rank
nb_proc
=
_mpi
.
nb_proc
if
nb_proc
>
1
:
comm
=
_mpi
.
comm
rank
=
_mpi
.
rank
nb_proc
=
_mpi
.
nb_proc
if
nb_proc
>
1
:
comm
=
_mpi
.
comm
from
.log
import
logger
def
barrier
():
...
...
fluidpythran/pythranizer.py
View file @
39de205b
...
...
@@ -30,6 +30,7 @@ from pathlib import Path
from
typing
import
Union
,
Iterable
,
Optional
import
sysconfig
import
hashlib
import
os
from
.compat
import
open
,
implementation
from
.
import
mpi
...
...
@@ -134,10 +135,13 @@ class SchedulerPopen:
process
=
None
if
mpi
.
rank
==
0
:
os
.
environ
[
"__FLUIDPYTHRAN_NO_MPI"
]
=
"1"
process
=
subprocess
.
Popen
(
words_command
,
cwd
=
cwd
)
process
=
mpi
.
ShellProcessMPI
(
process
)
self
.
processes
.
append
(
process
)
if
mpi
.
rank
==
0
:
self
.
processes
.
append
(
process
)
return
process
...
...
fluidpythran/run.py
View file @
39de205b
...
...
@@ -175,4 +175,4 @@ def pythran_fluid():
path_tmp
.
rename
(
path_out
)
logger
.
info
(
f
"file
{
Path
.
cwd
()
/
path_out
.
name
}
created"
)
else
:
logger
.
error
(
f
"file
{
Path
.
cwd
()
/
path_tmp
.
name
}
has not been created by Pythran"
)
\ No newline at end of file
logger
.
error
(
f
"file
{
Path
.
cwd
()
/
path_tmp
.
name
}
has not been created by Pythran"
)
fluidpythran/util.py
View file @
39de205b
...
...
@@ -56,7 +56,6 @@ try:
except
ImportError
:
pass
from
.compat
import
implementation
from
.pythranizer
import
(
ext_suffix
,
name_ext_from_path_pythran
,
...
...
@@ -257,10 +256,11 @@ def clear_cached_extensions(module_name: str, force: bool = False):
return
if
path_pythran_dir_jit
.
exists
()
and
query_yes_no
(
f
"Do you confirm that you want to delete the
JIT
cache for
{
module_name
}
"
,
f
"Do you confirm that you want to delete the cache
d files
for
{
module_name
}
"
,
default
=
"y"
,
force
=
force
,
):
print
(
f
"Remove directory
{
path_pythran_dir_jit
}
"
)
shutil
.
rmtree
(
path_pythran_dir_jit
)
if
path_pythran
.
exists
()
or
path_ext
.
exists
():
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment