Skip to content

Commit 73372ca

Browse files
author
Damian Rouson
committed
Corrected bugs in 'caf' script and improved the usage information it prints to specify which restrictions apply with which compilers.
1 parent b30cd90 commit 73372ca

File tree

1 file changed

+46
-33
lines changed

1 file changed

+46
-33
lines changed

src/extensions/caf-foot

+46-33
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,63 @@
1+
cmd=`basename $0`
2+
13
usage()
24
{
3-
cmd=`basename $0`
45
echo ""
56
echo " $cmd - Fortran compiler wrapper for OpenCoarrays"
67
echo ""
78
echo " Usage: $cmd <fortran-source-file> [options] ..."
89
echo ""
910
echo " Options:"
10-
echo " --help, -h Show this help message"
11-
echo " --version, -v, -V Report version and copyright information"
12-
echo " --wrapping, -w, Report the name of the wrapped compiler"
11+
echo " --help, -h Show this help message"
12+
echo " --version, -v, -V Report version and copyright information"
13+
echo " --wrapping, -w, --wraps Report the name of the wrapped compiler"
1314
echo ""
1415
echo " Example usage:"
1516
echo ""
1617
echo " $cmd foo.f90 -o foo"
1718
echo " $cmd -v"
1819
echo " $cmd --help"
1920
echo ""
20-
echo " Version $caf_version Restrictions:"
21-
echo " 1. If any of the options listed above apear, any remaining arguments are ignored."
22-
echo " 2. If present, <fortran-source-file>,"
23-
echo " a. must be a Fortran source file,"
24-
echo " b. must appear before all other arguments,"
25-
echo " c. must be the only Fortran source file in the argument list,"
26-
echo " d. must have a name of the form *.f90, *.F90, *.f, or *.F. "
27-
echo " 3. The environment variable 'FC' must be empty or point to a Fortran compiler/linker. "
28-
echo " 4. If 'FC' is empty, a default value of 'mpif90' is used. "
29-
echo " 5. Each scope containing CAF source must include one or more 'use opencoarrays' statements."
30-
echo " 6. The only CAF statements or expressions are"
31-
echo " a. 'num_images()' "
32-
echo " b. 'this_image()' with or without arguments"
33-
echo " c. 'sync all' with or without arguments."
34-
echo " d. 'sync images' with or without arguments."
35-
echo " e. 'error stop' without arguments."
36-
echo " f. 'co_sum', 'co_max', 'co_min', or 'co_reduce'"
37-
echo " f. 'put' or 'get'"
38-
echo " 7. Coarray codimensions must either be"
39-
echo " a. replaced by an invocation of 'get' in expressions."
40-
echo " b. replaced by an invocation of 'put' on the left-hand side of assignments."
21+
echo "OpenCoarrays $caf_version $cmd supports three categories of compilers"
22+
echo "with the following restrictions for each use case:"
23+
echo ""
24+
echo " 1. With an OpenCoarrays-Aware (OCA) compiler (GNU 5.1.0 or later),"
25+
echo " a. If any of the options listed above appear, any remaining arguments are ignored."
26+
echo " b. If present, <fortran-source-file> must"
27+
echo " * be a Fortran source file,"
28+
echo " * appear before all other arguments,"
29+
echo " * be the only Fortran source file in the argument list,"
30+
echo " * have a name of the form *.f90, *.F90, *.f, or *.F. "
31+
echo " c. The environment variable 'FC' must be empty or point to a Fortran compiler/linker. "
32+
echo " d. If 'FC' is empty, a default value of 'mpif90' is used. "
33+
echo ""
34+
echo " 2. With non-OCA CAF compilers (Intel or Cray),"
35+
echo " a. Observe restrictions 1a-d above."
36+
echo " b. Access OpenCoarrays collective subroutines via use association with an only clause,"
37+
echo " e.g., 'use opencoarrays, only : co_sum,co_broadcast' "
4138
echo ""
42-
echo " The caf wrapper will append -L, -l, and -fcoarray arguments "
43-
echo " with values that get set during the OpenCoarrays build process."
39+
echo " 3. With non-CAF compilers (all compilers not named above),"
40+
echo " a. Observe restrictions 1a-d above."
41+
echo " b. Access OpenCoarrays capabilities via use association ('use opencoarrays')."
42+
echo " c. The only CAF statements or expressions allowed are the following:"
43+
echo " * 'num_images()' "
44+
echo " * 'this_image()' with or without arguments"
45+
echo " * 'sync all' with or without arguments."
46+
echo " * 'sync images' with or without arguments."
47+
echo " * 'error stop' without arguments."
48+
echo " * 'co_sum', 'co_broadcast', 'co_max', 'co_min', or 'co_reduce'"
49+
echo ""
50+
echo " The caf wrapper will append -L, -l, and other required arguments as necessary"
51+
echo " using values that get set during the OpenCoarrays build and installation."
4452
echo ""
4553

4654
exit 1
4755
}
4856

4957
# Print useage information if caf is invoked without arguments
5058
if [ $# == 0 ]; then
51-
usage
59+
usage | less
60+
exit 1
5261
fi
5362

5463
# Default to "mpif90" Fortran compiler if environment variable FC has zero length:
@@ -70,6 +79,12 @@ if [[ $1 == '-v' || $1 == '-V' || $1 == '--version' ]]; then
7079
echo "BSD 3-Clause License. For more information about these matters, see"
7180
echo "the file named COPYRIGHT-BSD3."
7281
echo ""
82+
elif [[ $1 == '-w' || $1 == '--wrapping' || $1 == '--wraps' ]]; then
83+
echo "caf wraps FC=$FC"
84+
elif [[ $1 == '-h' || $1 == '--help' ]]; then
85+
# Print usage information
86+
usage | less
87+
exit 1
7388
elif [ "$caf_compiler" = "true" ]; then
7489
# Nothing to do other than invoke the compiler with all the command-line arguments:
7590
$FC "$@" -L $caf_lib_dir $link_args
@@ -94,11 +109,9 @@ else
94109
set -- "caf-$1" "${@:2:max_arguments}"
95110
# Invoke the compiler along with all command-line arguments:
96111
$FC "$@" -L $caf_lib_dir -I $caf_mod_dir $link_args
97-
elif [[ $1 == '-w' || $1 == '--wrapping' ]]; then
98-
echo "caf wraps FC=$FC"
99-
elif [[ $1 == '-h' || $1 == '--help' ]]; then
100-
usage
101112
else
102-
usage
113+
# Print usage information upon encountering an unknowon CAF source file extension
114+
usage | less
115+
exit 1
103116
fi
104117
fi

0 commit comments

Comments
 (0)