1
+ cmd=`basename $0`
2
+
1
3
usage()
2
4
{
3
- cmd=`basename $0`
4
5
echo ""
5
6
echo " $cmd - Fortran compiler wrapper for OpenCoarrays"
6
7
echo ""
7
8
echo " Usage: $cmd <fortran-source-file> [options] ..."
8
9
echo ""
9
10
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"
13
14
echo ""
14
15
echo " Example usage:"
15
16
echo ""
16
17
echo " $cmd foo.f90 -o foo"
17
18
echo " $cmd -v"
18
19
echo " $cmd --help"
19
20
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' "
41
38
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."
44
52
echo ""
45
53
46
54
exit 1
47
55
}
48
56
49
57
# Print useage information if caf is invoked without arguments
50
58
if [ $# == 0 ]; then
51
- usage
59
+ usage | less
60
+ exit 1
52
61
fi
53
62
54
63
# Default to "mpif90" Fortran compiler if environment variable FC has zero length:
@@ -70,6 +79,12 @@ if [[ $1 == '-v' || $1 == '-V' || $1 == '--version' ]]; then
70
79
echo "BSD 3-Clause License. For more information about these matters, see"
71
80
echo "the file named COPYRIGHT-BSD3."
72
81
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
73
88
elif [ "$caf_compiler" = "true" ]; then
74
89
# Nothing to do other than invoke the compiler with all the command-line arguments:
75
90
$FC "$@" -L $caf_lib_dir $link_args
94
109
set -- "caf-$1" "${@:2:max_arguments}"
95
110
# Invoke the compiler along with all command-line arguments:
96
111
$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
101
112
else
102
- usage
113
+ # Print usage information upon encountering an unknowon CAF source file extension
114
+ usage | less
115
+ exit 1
103
116
fi
104
117
fi
0 commit comments