10
0
mirror of https://gitlab.com/scemama/irpf90.git synced 2024-06-28 16:12:07 +02:00

Locks initialized in openmp mode

This commit is contained in:
Anthony Scemama 2014-10-08 22:56:54 +02:00
parent d17c2870e0
commit 5a3af0649a
5 changed files with 24 additions and 17 deletions

View File

@ -3,8 +3,6 @@ IRPF90
IRPF90 is a Fortran90 preprocessor written in Python for programming using the Implicit Reference to Parameters (IRP) method. It simplifies the development of large fortran codes in the field of scientific high performance computing. IRPF90 is a Fortran90 preprocessor written in Python for programming using the Implicit Reference to Parameters (IRP) method. It simplifies the development of large fortran codes in the field of scientific high performance computing.
![IRPF90 Logo](Irpf90.xpm)
Dependencies Dependencies
------------ ------------
@ -18,14 +16,14 @@ Installing IRPF90
``${IRPF90_HOME}`` is the location of your irpf90 directory:: ``${IRPF90_HOME}`` is the location of your irpf90 directory::
``` bash ``` bash
cd ${IRPF90_HOME} cd ${IRPF90_HOME}
make make
cat << EOF >> ${HOME}/.bash_profile cat << EOF >> ${HOME}/.bash_profile
export PYTHONPATH=${IRPF90_HOME}/src:${PYTHONPATH} export PYTHONPATH=${IRPF90_HOME}/src:${PYTHONPATH}
export PATH=${IRPF90_HOME}/bin:${PATH} export PATH=${IRPF90_HOME}/bin:${PATH}
export MANPATH=${IRPF90_HOME}/man:${MANPATH} export MANPATH=${IRPF90_HOME}/man:${MANPATH}
EOF EOF
. ${HOME}/.bash_profile source ${HOME}/.bash_profile
``` ```
@ -35,7 +33,7 @@ Using IRPF90
In an empty directory, run: In an empty directory, run:
``` bash ``` bash
irpf90 --init irpf90 --init
``` ```
This command creates a new Makefile suitable for most irpf90 projects. This command creates a new Makefile suitable for most irpf90 projects.

View File

@ -33,7 +33,7 @@ case "$0" in
local cur local cur
COMPREPLY=() COMPREPLY=()
cur=${COMP_WORDS[COMP_CWORD]} cur=${COMP_WORDS[COMP_CWORD]}
COMPREPLY=( $(compgen -W "`cat tags | cut -d' ' -f 1`" -- "$cur" ) ) COMPREPLY=( $(compgen -W "`[[ -f tags ]] && cat tags | cut -d' ' -f 1`" -- "$cur" ) )
} && complete -F _irpman_complete irpman } && complete -F _irpman_complete irpman
;; ;;

View File

@ -40,6 +40,13 @@ def create():
var = variables[v] var = variables[v]
out += var.locker out += var.locker
out += [
"subroutine irp_init_locks_%s()"%(irp_id),
" implicit none" ]
for v in l:
out += [ " call irp_lock_%s(.True.)"%v ]
out += [ " call irp_lock_%s(.False.)"%v ]
out += [ "end subroutine" ]
out = map(lambda x: "%s\n"%(x),out) out = map(lambda x: "%s\n"%(x),out)
if not same_file(FILENAME,out): if not same_file(FILENAME,out):
file = open(FILENAME,'w') file = open(FILENAME,'w')

View File

@ -627,6 +627,8 @@ def irp_simple_statements(text):
temp = [ Program(0,"program irp_program",program_name) ] temp = [ Program(0,"program irp_program",program_name) ]
if command_line.do_profile: if command_line.do_profile:
temp += [ Simple_line(0,"call irp_init_timer()",line.filename) ] temp += [ Simple_line(0,"call irp_init_timer()",line.filename) ]
if command_line.do_openmp:
temp += [ Simple_line(0," call irp_init_locks_%s()"%(irp_id),line.filename) ]
temp += [ Call(0," call %s"%(program_name),line.filename) ] temp += [ Call(0," call %s"%(program_name),line.filename) ]
if command_line.do_profile: if command_line.do_profile:
temp += [ Simple_line(0,"call irp_print_timer()",line.filename) ] temp += [ Simple_line(0,"call irp_print_timer()",line.filename) ]

View File

@ -465,7 +465,7 @@ class Variable(object):
same_as = self.same_as same_as = self.same_as
def check_openmp(): def check_openmp():
if not do_openmp: if not command_line.do_openmp:
result = [ "!$ nthreads = omp_get_num_threads()" , result = [ "!$ nthreads = omp_get_num_threads()" ,
"!$ if (nthreads > 1) then" , "!$ if (nthreads > 1) then" ,
"!$ print *, irp_here//': Error: Provider in an openMP section'" , "!$ print *, irp_here//': Error: Provider in an openMP section'" ,
@ -610,7 +610,7 @@ class Variable(object):
text = parsed_text.move_to_top(text,Implicit) text = parsed_text.move_to_top(text,Implicit)
text = parsed_text.move_to_top(text,Use) text = parsed_text.move_to_top(text,Use)
text = map(lambda x: x[1], text) text = map(lambda x: x[1], text)
inside_omp = False # inside_omp = False
for line in filter(lambda x: type(x) not in [ Begin_doc, End_doc, Doc], text): for line in filter(lambda x: type(x) not in [ Begin_doc, End_doc, Doc], text):
if type(line) == Begin_provider: if type(line) == Begin_provider:
result = [] result = []
@ -630,10 +630,10 @@ class Variable(object):
# Detect OpenMP blocks # Detect OpenMP blocks
buffer = line.text.lower().split() buffer = line.text.lower().split()
if buffer[1] == "parallel": if buffer[1] == "parallel":
inside_omp = True # inside_omp = True
self._has_openmp = True self._has_openmp = True
if buffer[1] == "end" and buffer[2] == "parallel": # if buffer[1] == "end" and buffer[2] == "parallel":
inside_omp = False # inside_omp = False
result.append(line.text) result.append(line.text)
else: else:
# if inside_omp: # if inside_omp: