summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/globalarrays/ibm-xl.patch
blob: 644e3a559a93be11c6f8e28483544352d9f15420 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2022280..dac3b7f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -174,6 +174,15 @@ option (F2C_HIDDEN_STRING_LENGTH_AFTER_ARGS "Set F77 macros" ON)
 if (ENABLE_FORTRAN)
   include( FortranCInterface )
   FortranCInterface_HEADER(${CMAKE_SOURCE_DIR}/f2c_cmake.h MACRO_NAMESPACE F77_FUNC_)
+  add_custom_command(
+    OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/f2c_cmake.fh
+    COMMAND ${CMAKE_COMMAND} -D INPUT:PATH="${CMAKE_CURRENT_SOURCE_DIR}/f2c_cmake.h" -D OUTPUT:PATH="${CMAKE_CURRENT_SOURCE_DIR}/f2c_cmake.fh" -P ${PROJECT_SOURCE_DIR}/tools/f2c_cmake_fh_from_h.cmake DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/f2c_cmake.h
+    DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/f2c_cmake.h
+  )
+  add_custom_target(
+    GenerateF2c_cmakeFH ALL
+    DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/f2c_cmake.fh
+  )
 else()
   CONFIGURE_FILE( ${CMAKE_SOURCE_DIR}/cmake/f2c_dummy.h.in
                 ${CMAKE_SOURCE_DIR}/f2c_cmake.h )
@@ -336,6 +345,15 @@ if (ENABLE_FORTRAN)
      set (F77_IARGC IARGC)
      set (F77_FLUSH flush)
      set (HAVE_F77_FLUSH 1)
+  elseif (CMAKE_Fortran_COMPILER MATCHES "xlf.*")
+     message(STATUS "Using IBM XL Fortran compiler settings")
+     set (F90_MODULE )
+     set (F77_GETARG GETARG)
+     set (F77_GETARG_ARGS "i,s")
+     set (F77_GETARG_DECLS "intrinsic GETARG")
+     set (F77_IARGC IARGC)
+     set (F77_FLUSH flush_)
+     set (HAVE_F77_FLUSH 1)
   endif()
 else()
 # need to set these variable even if only compiling C/C++
diff --git a/cmake/config.h.in b/cmake/config.h.in
index 3ce6a32..9ad868f 100644
--- a/cmake/config.h.in
+++ b/cmake/config.h.in
@@ -58,11 +58,11 @@
 
 #cmakedefine01 F2C_HIDDEN_STRING_LENGTH_AFTER_ARGS
 
-/*#define F77_FUNC(name,NAME) F77_FUNC_GLOBAL(name,NAME)*/
-/*#define F77_FUNC_(name,NAME) F77_FUNC_GLOBAL_(name,NAME)*/
+#define F77_FUNC(name,NAME) F77_FUNC_GLOBAL(name,NAME)
+#define F77_FUNC_(name,NAME) F77_FUNC_GLOBAL_(name,NAME)
 
-#define F77_FUNC(name,NAME) name ## _
-#define F77_FUNC_(name,NAME) name ## _
+/* #define F77_FUNC(name,NAME) name ## _ */
+/* #define F77_FUNC_(name,NAME) name ## _ */
 
 #define FXX_MODULE ${F90_MODULE}
 #define F77_GETARG ${F77_GETARG}
diff --git a/tools/config_fh_from_h.cmake b/tools/config_fh_from_h.cmake
index acdf776..fb10422 100644
--- a/tools/config_fh_from_h.cmake
+++ b/tools/config_fh_from_h.cmake
@@ -7,6 +7,13 @@ if (INPUT)
     foreach (l in ${in0})
       # Only retain lines that start with "#"
       set(found "")
+      string(REGEX MATCH "^#include" found "${l}")
+      if (found)
+        # don't include f2c_cmake.h
+        set(out "#include \"f2c_cmake.fh\"\n")
+       continue ()
+      endif ()
+      set(found "") 
       string(REGEX MATCH "^#" found "${l}")
       if (found)
         set(out "${out}${l}\n")
diff --git a/tools/f2c_cmake_fh_from_h.cmake b/tools/f2c_cmake_fh_from_h.cmake
new file mode 100644
index 0000000..acdf776
--- /dev/null
+++ b/tools/f2c_cmake_fh_from_h.cmake
@@ -0,0 +1,21 @@
+if (INPUT)
+  if (OUTPUT)
+    file(READ "${INPUT}" in0)
+# replace carriage returns with a semi-colon
+    string (REGEX REPLACE "\n" ";" in0 "${in0}")
+    set(out "")
+    foreach (l in ${in0})
+      # Only retain lines that start with "#"
+      set(found "")
+      string(REGEX MATCH "^#" found "${l}")
+      if (found)
+        set(out "${out}${l}\n")
+      endif ()  
+    endforeach ()
+    file(WRITE "${OUTPUT}" "${out}")
+  else (OUTPUT)
+    message(ERROR "OUTPUT variable must be set")
+  endif (OUTPUT)
+else (INPUT)
+  message(ERROR "INPUT variable must be set")
+endif (INPUT)
diff --git a/global/src/cnames.h b/global/src/cnames.h
index efdec60..cadfd0a 100644
--- a/global/src/cnames.h
+++ b/global/src/cnames.h
@@ -2268,6 +2268,7 @@
 #define nga_iupdate_ghosts_ F77_FUNC_(nga_iupdate_ghosts,NGA_IUPDATE_GHOSTS)
 #define nga_supdate_ghosts_ F77_FUNC_(nga_supdate_ghosts,NGA_SUPDATE_GHOSTS)
 #define nga_zupdate_ghosts_ F77_FUNC_(nga_zupdate_ghosts,NGA_ZUPDATE_GHOSTS)
+#define nga_update_ghosts_nb_ F77_FUNC_(nga_update_ghosts_nb, NGA_UPDATE_GHOSTS_NB)
 #define ga_update6_ghosts_  F77_FUNC_(ga_update6_ghosts, GA_UPDATE6_GHOSTS)
 #define ga_cupdate6_ghosts_ F77_FUNC_(ga_cupdate6_ghosts,GA_CUPDATE6_GHOSTS)
 #define ga_dupdate6_ghosts_ F77_FUNC_(ga_dupdate6_ghosts,GA_DUPDATE6_GHOSTS)
diff --git a/global/testing/perform.F b/global/testing/perform.F
index b18146d..e1b9641 100644
--- a/global/testing/perform.F
+++ b/global/testing/perform.F
@@ -110,7 +110,7 @@ c
      &        ilo,ihi,jlo,jhi
         write(6,*)'bytes  loop         get                    put',
      &           '                 accumulate'
-        call flush(6)
+        call F77_FLUSH(6)
       endif
       call ga_sync()
 c
@@ -145,7 +145,7 @@ c
         if (me .eq. 0) then
           write(6,77)bytes, count, tg, 1d-6*bytes/tg,
      &               tp, 1d-6*bytes/tp, ta, 1d-6*bytes/ta
-          call flush(6)
+          call F77_FLUSH(6)
         endif
       enddo
 c
diff --git a/global/testing/mir_perf1.F b/global/testing/mir_perf1.F
index 074e838..3548552 100644
--- a/global/testing/mir_perf1.F
+++ b/global/testing/mir_perf1.F
@@ -133,7 +133,7 @@ c
      &           '           accumulate'
         write(6,*)' bytes    dim     sec      MB/s     sec      MB/s',
      &           '     sec      MB/s'
-        call flush(6)
+        call F77_FLUSH(6)
       endif
       call ga_sync()
 c
@@ -174,7 +174,7 @@ c
         if (me .eq. 0) then
           write(6,77)bytes, chunk(loop), tg, 
      &          1d-6*bytes/tg,tp, 1d-6*bytes/tp, ta, 1d-6*bytes/ta
-          call flush(6)
+          call F77_FLUSH(6)
         endif
       enddo
 c
@@ -388,7 +388,7 @@ c
      &           '           accumulate'
         write(6,*)' bytes    dim     sec      MB/s     sec      MB/s',
      &           '     sec      MB/s'
-        call flush(6)
+        call F77_FLUSH(6)
       endif
       call ga_sync()
 c
@@ -427,7 +427,7 @@ c
         if (me .eq. 0) then
           write(6,77)bytes, chunk(loop), tg, 
      &          1d-6*bytes/tg,tp, 1d-6*bytes/tp, ta, 1d-6*bytes/ta
-          call flush(6)
+          call F77_FLUSH(6)
         endif
       enddo
 c
diff --git a/global/testing/mir_perf2.F b/global/testing/mir_perf2.F
index fb50398..3b3bed6 100644
--- a/global/testing/mir_perf2.F
+++ b/global/testing/mir_perf2.F
@@ -124,7 +124,7 @@ c
      &           '           accumulate'
         write(6,*)' bytes    dim     sec      MB/s     sec      MB/s',
      &           '     sec      MB/s'
-        call flush(6)
+        call F77_FLUSH(6)
       endif
       call ga_sync()
 c
@@ -163,7 +163,7 @@ c
         if (me .eq. 0) then
           write(6,77)bytes, chunk(loop), tg, 
      &          1d-6*bytes/tg,tp, 1d-6*bytes/tp, ta, 1d-6*bytes/ta
-          call flush(6)
+          call F77_FLUSH(6)
         endif
       enddo
 c
@@ -377,7 +377,7 @@ c
      &           '           accumulate'
         write(6,*)' bytes    dim     sec      MB/s     sec      MB/s',
      &           '     sec      MB/s'
-        call flush(6)
+        call F77_FLUSH(6)
       endif
       call ga_sync()
 c
@@ -416,7 +416,7 @@ c
         if (me .eq. 0) then
           write(6,77)bytes, chunk(loop), tg, 
      &          1d-6*bytes/tg,tp, 1d-6*bytes/tp, ta, 1d-6*bytes/ta
-          call flush(6)
+          call F77_FLUSH(6)
         endif
       enddo
 c
diff --git a/global/testing/perfmod.F b/global/testing/perfmod.F
index ec3fe37..7770be7 100644
--- a/global/testing/perfmod.F
+++ b/global/testing/perfmod.F
@@ -119,7 +119,7 @@ c
 
         write(6,*)'bytes  loop         get                    put',
      &           '                 accumulate'
-        call flush(6)
+        call F77_FLUSH(6)
       endif
       call ga_sync()
 c
@@ -157,7 +157,7 @@ c
         if (me .eq. 0) then
           write(6,77)bytes, count, tg, 1d-6*bytes/tg,
      &               tp, 1d-6*bytes/tp, ta, 1d-6*bytes/ta
-          call flush(6)
+          call F77_FLUSH(6)
         endif
       enddo
 c
diff --git a/global/testing/sprsmatmult.F b/global/testing/sprsmatmult.F
index 3fdeb3f..3682c3b 100644
--- a/global/testing/sprsmatmult.F
+++ b/global/testing/sprsmatmult.F
@@ -108,7 +108,7 @@ c
         print *,'Comparing distributed multiply with serial multiply'
         print *
 #endif
-        call flush(6)
+        call F77_FLUSH(6)
       endif
 c
 c***  Initialize the MA package