/[MITgcm]/MITgcm_contrib/heimbach/OpenAD/code_shallow_openad/ad_inline.f
ViewVC logotype

Contents of /MITgcm_contrib/heimbach/OpenAD/code_shallow_openad/ad_inline.f

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.4 - (show annotations) (download)
Thu Dec 19 16:09:57 2013 UTC (12 years, 10 months ago) by utke
Branch: MAIN
CVS Tags: HEAD
Changes since 1.3: +0 -0 lines
FILE REMOVED
stale

1 C taping --------------------------------------------
2
3
4 subroutine push(x)
5 C $OpenAD$ INLINE DECLS
6 double precision :: x
7 C $OpenAD$ END DECLS
8 if(double_tape_size .lt. double_tape_pointer) then
9 print *, "DT+ ", double_tape_size*2
10 allocate(double_tmp_tape(double_tape_size),
11 +STAT=cp_loop_variable_1)
12 if (cp_loop_variable_1 .gt. 0 ) then
13 print *,'allocation (1)failed with', cp_loop_variable_1
14 stop
15 end if
16 double_tmp_tape=double_tape
17 deallocate(double_tape)
18 allocate(double_tape(double_tape_size*2),
19 +STAT=cp_loop_variable_1)
20 if (cp_loop_variable_1 .gt. 0 ) then
21 print *,'allocation (2)failed with', cp_loop_variable_1
22 stop
23 end if
24 double_tape(1:double_tape_size) = double_tmp_tape
25 deallocate(double_tmp_tape)
26 double_tape_size=double_tape_size*2
27 end if
28 double_tape(double_tape_pointer)=x
29 double_tape_pointer=double_tape_pointer+1
30 end subroutine
31
32
33 subroutine pop(x)
34 C $OpenAD$ INLINE DECLS
35 double precision :: x
36 C $OpenAD$ END DECLS
37 double_tape_pointer=double_tape_pointer-1
38 x=double_tape(double_tape_pointer)
39 end subroutine
40
41
42 subroutine push_i(x)
43 C $OpenAD$ INLINE DECLS
44 integer :: x
45 C $OpenAD$ END DECLS
46 if(integer_tape_size .lt. integer_tape_pointer) then
47 print *, "IT+ ", integer_tape_size*2
48 allocate(integer_tmp_tape(integer_tape_size),
49 +STAT=cp_loop_variable_1)
50 if (cp_loop_variable_1 .gt. 0 ) then
51 print *,'allocation (1)failed with', cp_loop_variable_1
52 stop
53 end if
54 integer_tmp_tape=integer_tape
55 deallocate(integer_tape)
56 allocate(integer_tape(integer_tape_size*2),
57 +STAT=cp_loop_variable_1)
58 if (cp_loop_variable_1 .gt. 0 ) then
59 print *,'allocation (2)failed with', cp_loop_variable_1
60 stop
61 end if
62 integer_tape(1:integer_tape_size) = integer_tmp_tape
63 deallocate(integer_tmp_tape)
64 integer_tape_size=integer_tape_size*2
65 end if
66 integer_tape(integer_tape_pointer)=x
67 integer_tape_pointer=integer_tape_pointer+1
68 end subroutine
69
70 subroutine pop_i(x)
71 C $OpenAD$ INLINE DECLS
72 use OpenAD_tape
73 implicit none
74 integer :: x
75 C $OpenAD$ END DECLS
76 integer_tape_pointer=integer_tape_pointer-1
77 x=integer_tape(integer_tape_pointer)
78 end subroutine
79
80 subroutine saxpy(a,x,y)
81 C $OpenAD$ INLINE DECLS
82 double precision, intent(in) :: a
83 type(active), intent(in) :: x
84 type(active), intent(inout) :: y
85 C $OpenAD$ END DECLS
86 y%d=y%d+x%d*a
87 end subroutine
88
89 subroutine zeroderiv(x)
90 C $OpenAD$ INLINE DECLS
91 type(active), intent(out) :: x
92 C $OpenAD$ END DECLS
93 x%d=0.0d0
94 end subroutine
95
96 subroutine setderiv(y,x)
97 C $OpenAD$ INLINE DECLS
98 type(active), intent(out) :: x
99 type(active), intent(in) :: y
100 C $OpenAD$ END DECLS
101 x%d=y%d
102 end subroutine
103
104
105 subroutine incderiv(y,x)
106 C $OpenAD$ INLINE DECLS
107 type(active), intent(out) :: x
108 type(active), intent(in) :: y
109 C $OpenAD$ END DECLS
110 x%d=x%d+y%d
111 end subroutine
112
113 subroutine condinczeroderiv(y,x)
114 C $OpenAD$ INLINE DECLS
115 type(active), intent(out) :: x
116 type(active), intent(in) :: y
117 C $OpenAD$ END DECLS
118 if (iaddr(y).ne.iaddr(x)) then
119 x%d=x%d+y%d
120 y%d=0
121 end if
122 end subroutine
123
124 C Checkpointing stuff ---------------------------------------
125
126 C reals -----------------------------------------------------
127 subroutine cp_arg_store_real_scalar(x)
128 C $OpenAD$ INLINE DECLS
129 double precision :: x
130 C $OpenAD$ END DECLS
131 if(cp_double_size .lt. cp_double_pointer+1) then
132 allocate(cp_double_tmp(cp_double_size))
133 cp_double_tmp=cp_double
134 deallocate(cp_double)
135 allocate(cp_double(cp_double_size*2))
136 print *,'CPD+'
137 cp_double(1:cp_double_size) = cp_double_tmp
138 deallocate(cp_double_tmp)
139 cp_double_size=cp_double_size*2
140 end if
141 cp_double_pointer=cp_double_pointer+1
142 cp_double(cp_double_pointer)=x
143 end subroutine
144
145 subroutine cp_arg_restore_real_scalar(x)
146 C $OpenAD$ INLINE DECLS
147 implicit none
148 double precision :: x
149 C $OpenAD$ END DECLS
150 x=cp_double(cp_double_pointer)
151 cp_double_pointer=cp_double_pointer-1
152 end subroutine
153
154 subroutine cp_arg_store_real_scalar_a(x)
155 C $OpenAD$ INLINE DECLS
156 double precision :: x
157 C $OpenAD$ END DECLS
158 if(cp_double_size .lt. cp_double_pointer+1) then
159 allocate(cp_double_tmp(cp_double_size))
160 cp_double_tmp=cp_double
161 deallocate(cp_double)
162 allocate(cp_double(cp_double_size*2))
163 print *,'CPD+'
164 cp_double(1:cp_double_size) = cp_double_tmp
165 deallocate(cp_double_tmp)
166 cp_double_size=cp_double_size*2
167 end if
168 cp_double_pointer=cp_double_pointer+1
169 cp_double(cp_double_pointer)=x%v
170 end subroutine
171
172 subroutine cp_arg_restore_real_scalar_a(x)
173 C $OpenAD$ INLINE DECLS
174 implicit none
175 double precision :: x
176 C $OpenAD$ END DECLS
177 x%v=cp_double(cp_double_pointer)
178 cp_double_pointer=cp_double_pointer-1
179 end subroutine
180
181 subroutine cp_arg_store_real_vector(x,cp_loop_variable_1)
182 C $OpenAD$ INLINE DECLS
183 implicit none
184 double precision, dimension(:) :: x
185 C $OpenAD$ END DECLS
186 do while (cp_double_size .lt.
187 +cp_double_pointer+ubound(x,1)-lbound(x,1))
188 allocate(cp_double_tmp(cp_double_size))
189 cp_double_tmp=cp_double
190 deallocate(cp_double)
191 allocate(cp_double(cp_double_size*2))
192 print *,'CPD+'
193 cp_double(1:cp_double_size) = cp_double_tmp
194 deallocate(cp_double_tmp)
195 cp_double_size=cp_double_size*2
196 end do
197 do cp_loop_variable_1=lbound(x,1), ubound(x,1), 1
198 cp_double_pointer=cp_double_pointer+1
199 cp_double(cp_double_pointer)=
200 +x(cp_loop_variable_1)
201 end do
202 end subroutine
203
204 subroutine cp_arg_restore_real_vector(x,cp_loop_variable_1)
205 C $OpenAD$ INLINE DECLS
206 implicit none
207 double precision, dimension(:) :: x
208 C $OpenAD$ END DECLS
209 do cp_loop_variable_1=ubound(x,1),lbound(x,1),-1
210 x(cp_loop_variable_1)=cp_double(cp_double_pointer)
211 cp_double_pointer=cp_double_pointer-1
212 C write(*,'(A,EN26.16E3)') "restore(v) ",
213 C +x(cp_loop_variable_1)%v
214 end do
215 end subroutine
216
217 subroutine cp_arg_store_real_vector_a(x,cp_loop_variable_1)
218 C $OpenAD$ INLINE DECLS
219 implicit none
220 double precision, dimension(:) :: x
221 C $OpenAD$ END DECLS
222 do while (cp_double_size .lt.
223 +cp_double_pointer+ubound(x,1)-lbound(x,1))
224 allocate(cp_double_tmp(cp_double_size))
225 cp_double_tmp=cp_double
226 deallocate(cp_double)
227 allocate(cp_double(cp_double_size*2))
228 print *,'CPD+'
229 cp_double(1:cp_double_size) = cp_double_tmp
230 deallocate(cp_double_tmp)
231 cp_double_size=cp_double_size*2
232 end do
233 do cp_loop_variable_1=lbound(x,1), ubound(x,1), 1
234 cp_double_pointer=cp_double_pointer+1
235 cp_double(cp_double_pointer)=
236 +x(cp_loop_variable_1)%v
237 end do
238 end subroutine
239
240 subroutine cp_arg_restore_real_vector_a(x,cp_loop_variable_1)
241 C $OpenAD$ INLINE DECLS
242 implicit none
243 double precision, dimension(:) :: x
244 C $OpenAD$ END DECLS
245 do cp_loop_variable_1=ubound(x,1),lbound(x,1),-1
246 x(cp_loop_variable_1)%v=cp_double(cp_double_pointer)
247 cp_double_pointer=cp_double_pointer-1
248 C write(*,'(A,EN26.16E3)') "restore(v) ",
249 C +x(cp_loop_variable_1)%v
250 end do
251 end subroutine
252
253 subroutine cp_arg_store_real_matrix(x,cp_loop_variable_1,
254 +cp_loop_variable_2)
255 C $OpenAD$ INLINE DECLS
256 implicit none
257 double precision, dimension(::) :: x
258 C $OpenAD$ END DECLS
259 do cp_loop_variable_1=lbound(x,1),ubound(x,1)
260 do while (cp_double_size .lt.
261 +cp_double_pointer+ubound(x,2)-lbound(x,2))
262 allocate(cp_double_tmp(cp_double_size))
263 cp_double_tmp=cp_double
264 deallocate(cp_double)
265 allocate(cp_double(cp_double_size*2))
266 print *,'CPD+'
267 cp_double(1:cp_double_size) = cp_double_tmp
268 deallocate(cp_double_tmp)
269 cp_double_size=cp_double_size*2
270 end do
271 do cp_loop_variable_2=lbound(x,2), ubound(x,2), 1
272 cp_double_pointer=cp_double_pointer+1
273 cp_double(cp_double_pointer)=
274 +x(cp_loop_variable_1,cp_loop_variable_2)
275 end do
276 end do
277 end subroutine
278
279 subroutine cp_arg_restore_real_matrix(x,cp_loop_variable_1,
280 +cp_loop_variable_2)
281 C $OpenAD$ INLINE DECLS
282 implicit none
283 double precision, dimension(::) :: x
284 C $OpenAD$ END DECLS
285 do cp_loop_variable_1=ubound(x,1),lbound(x,1),-1
286 do cp_loop_variable_2=ubound(x,2),lbound(x,2),-1
287 x(cp_loop_variable_1,cp_loop_variable_2)=
288 +cp_double(cp_double_pointer)
289 cp_double_pointer=cp_double_pointer-1
290 end do
291 end do
292 end subroutine
293
294 subroutine cp_arg_store_real_matrix_a(x,cp_loop_variable_1,
295 +cp_loop_variable_2)
296 C $OpenAD$ INLINE DECLS
297 implicit none
298 double precision, dimension(::) :: x
299 C $OpenAD$ END DECLS
300 do cp_loop_variable_1=lbound(x,1),ubound(x,1)
301 do while (cp_double_size .lt.
302 +cp_double_pointer+ubound(x,2)-lbound(x,2))
303 allocate(cp_double_tmp(cp_double_size))
304 cp_double_tmp=cp_double
305 deallocate(cp_double)
306 allocate(cp_double(cp_double_size*2))
307 print *,'CPD+'
308 cp_double(1:cp_double_size) = cp_double_tmp
309 deallocate(cp_double_tmp)
310 cp_double_size=cp_double_size*2
311 end do
312 do cp_loop_variable_2=lbound(x,2), ubound(x,2), 1
313 cp_double_pointer=cp_double_pointer+1
314 cp_double(cp_double_pointer)=
315 +x(cp_loop_variable_1,cp_loop_variable_2)%v
316 end do
317 end do
318 end subroutine
319
320 subroutine cp_arg_restore_real_matrix_a(x,cp_loop_variable_1,
321 +cp_loop_variable_2)
322 C $OpenAD$ INLINE DECLS
323 implicit none
324 double precision, dimension(::) :: x
325 C $OpenAD$ END DECLS
326 do cp_loop_variable_1=ubound(x,1),lbound(x,1),-1
327 do cp_loop_variable_2=ubound(x,2),lbound(x,2),-1
328 x(cp_loop_variable_1,cp_loop_variable_2)%v=
329 +cp_double(cp_double_pointer)
330 cp_double_pointer=cp_double_pointer-1
331 end do
332 end do
333 end subroutine
334
335 subroutine cp_arg_store_real_three_tensor(x,
336 +cp_loop_variable_1,
337 +cp_loop_variable_2,
338 +cp_loop_variable_3
339 +)
340 C $OpenAD$ INLINE DECLS
341 implicit none
342 double precision, dimension(::) :: x
343 C $OpenAD$ END DECLS
344 do cp_loop_variable_1=lbound(x,1),ubound(x,1)
345 do cp_loop_variable_2=lbound(x,2),ubound(x,2)
346 do while (cp_double_size .lt.
347 +cp_double_pointer+ubound(x,3)-lbound(x,3))
348 allocate(cp_double_tmp(cp_double_size))
349 cp_double_tmp=cp_double
350 deallocate(cp_double)
351 allocate(cp_double(cp_double_size*2))
352 print *,'CPD+'
353 cp_double(1:cp_double_size) = cp_double_tmp
354 deallocate(cp_double_tmp)
355 cp_double_size=cp_double_size*2
356 end do
357 do cp_loop_variable_3=lbound(x,3),ubound(x,3)
358 cp_double_pointer=cp_double_pointer+1
359 cp_double(cp_double_pointer)=
360 +x(
361 + cp_loop_variable_1,
362 + cp_loop_variable_2,
363 + cp_loop_variable_3
364 + )
365 end do
366 end do
367 end do
368 end subroutine
369
370 subroutine cp_arg_store_real_three_tensor_a(x,
371 +cp_loop_variable_1,
372 +cp_loop_variable_2,
373 +cp_loop_variable_3
374 +)
375 C $OpenAD$ INLINE DECLS
376 implicit none
377 double precision, dimension(::) :: x
378 C $OpenAD$ END DECLS
379 do cp_loop_variable_1=lbound(x,1),ubound(x,1)
380 do cp_loop_variable_2=lbound(x,2),ubound(x,2)
381 do while (cp_double_size .lt.
382 +cp_double_pointer+ubound(x,3)-lbound(x,3))
383 allocate(cp_double_tmp(cp_double_size))
384 cp_double_tmp=cp_double
385 deallocate(cp_double)
386 allocate(cp_double(cp_double_size*2))
387 print *,'CPD+'
388 cp_double(1:cp_double_size) = cp_double_tmp
389 deallocate(cp_double_tmp)
390 cp_double_size=cp_double_size*2
391 end do
392 do cp_loop_variable_3=lbound(x,3),ubound(x,3)
393 cp_double_pointer=cp_double_pointer+1
394 cp_double(cp_double_pointer)=
395 +x(
396 + cp_loop_variable_1,
397 + cp_loop_variable_2,
398 + cp_loop_variable_3
399 + )%v
400 end do
401 end do
402 end do
403 end subroutine
404
405 subroutine cp_arg_restore_real_three_tensor(x,
406 +cp_loop_variable_1,
407 +cp_loop_variable_2,
408 +cp_loop_variable_3
409 +)
410 C $OpenAD$ INLINE DECLS
411 implicit none
412 double precision, dimension(::) :: x
413 C $OpenAD$ END DECLS
414 do cp_loop_variable_1=ubound(x,1),lbound(x,1),-1
415 do cp_loop_variable_2=ubound(x,2),lbound(x,2),-1
416 do cp_loop_variable_3=ubound(x,3),lbound(x,3),-1
417 x(
418 + cp_loop_variable_1,
419 + cp_loop_variable_2,
420 + cp_loop_variable_3
421 + )=
422 +cp_double(cp_double_pointer)
423 cp_double_pointer=cp_double_pointer-1
424 end do
425 end do
426 end do
427 end subroutine
428
429 subroutine cp_arg_restore_real_three_tensor_a(x,
430 +cp_loop_variable_1,
431 +cp_loop_variable_2,
432 +cp_loop_variable_3
433 +)
434 C $OpenAD$ INLINE DECLS
435 implicit none
436 double precision, dimension(::) :: x
437 C $OpenAD$ END DECLS
438 do cp_loop_variable_1=ubound(x,1),lbound(x,1),-1
439 do cp_loop_variable_2=ubound(x,2),lbound(x,2),-1
440 do cp_loop_variable_3=ubound(x,3),lbound(x,3),-1
441 x(
442 + cp_loop_variable_1,
443 + cp_loop_variable_2,
444 + cp_loop_variable_3
445 + )%v=
446 +cp_double(cp_double_pointer)
447 cp_double_pointer=cp_double_pointer-1
448 end do
449 end do
450 end do
451 end subroutine
452
453 subroutine cp_arg_store_real_four_tensor(x,
454 +cp_loop_variable_1,
455 +cp_loop_variable_2,
456 +cp_loop_variable_3,
457 +cp_loop_variable_4
458 +)
459 C $OpenAD$ INLINE DECLS
460 implicit none
461 double precision, dimension(::) :: x
462 C $OpenAD$ END DECLS
463 do cp_loop_variable_1=lbound(x,1),ubound(x,1)
464 do cp_loop_variable_2=lbound(x,2),ubound(x,2)
465 do cp_loop_variable_3=lbound(x,3),ubound(x,3)
466 do while (cp_double_size .lt.
467 +cp_double_pointer+ubound(x,4)-lbound(x,4))
468 allocate(cp_double_tmp(cp_double_size))
469 cp_double_tmp=cp_double
470 deallocate(cp_double)
471 allocate(cp_double(cp_double_size*2))
472 print *,'CPD+'
473 cp_double(1:cp_double_size) = cp_double_tmp
474 deallocate(cp_double_tmp)
475 cp_double_size=cp_double_size*2
476 end do
477 do cp_loop_variable_4=lbound(x,4),ubound(x,4)
478 cp_double_pointer=cp_double_pointer+1
479 cp_double(cp_double_pointer)=
480 +x(
481 + cp_loop_variable_1,
482 + cp_loop_variable_2,
483 + cp_loop_variable_3,
484 + cp_loop_variable_4
485 + )
486 end do
487 end do
488 end do
489 end do
490 end subroutine
491
492 subroutine cp_arg_store_real_four_tensor_a(x,
493 +cp_loop_variable_1,
494 +cp_loop_variable_2,
495 +cp_loop_variable_3,
496 +cp_loop_variable_4
497 +)
498 C $OpenAD$ INLINE DECLS
499 implicit none
500 double precision, dimension(::) :: x
501 C $OpenAD$ END DECLS
502 do cp_loop_variable_1=lbound(x,1),ubound(x,1)
503 do cp_loop_variable_2=lbound(x,2),ubound(x,2)
504 do cp_loop_variable_3=lbound(x,3),ubound(x,3)
505 do while (cp_double_size .lt.
506 +cp_double_pointer+ubound(x,4)-lbound(x,4))
507 allocate(cp_double_tmp(cp_double_size))
508 cp_double_tmp=cp_double
509 deallocate(cp_double)
510 allocate(cp_double(cp_double_size*2))
511 print *,'CPD+'
512 cp_double(1:cp_double_size) = cp_double_tmp
513 deallocate(cp_double_tmp)
514 cp_double_size=cp_double_size*2
515 end do
516 do cp_loop_variable_4=lbound(x,4),ubound(x,4)
517 cp_double_pointer=cp_double_pointer+1
518 cp_double(cp_double_pointer)=
519 +x(
520 + cp_loop_variable_1,
521 + cp_loop_variable_2,
522 + cp_loop_variable_3,
523 + cp_loop_variable_4
524 + )%v
525 end do
526 end do
527 end do
528 end do
529 end subroutine
530
531 subroutine cp_arg_restore_real_four_tensor(x,
532 +cp_loop_variable_1,
533 +cp_loop_variable_2,
534 +cp_loop_variable_3,
535 +cp_loop_variable_4
536 +)
537 C $OpenAD$ INLINE DECLS
538 implicit none
539 double precision, dimension(::) :: x
540 C $OpenAD$ END DECLS
541 do cp_loop_variable_1=ubound(x,1),lbound(x,1),-1
542 do cp_loop_variable_2=ubound(x,2),lbound(x,2),-1
543 do cp_loop_variable_3=ubound(x,3),lbound(x,3),-1
544 do cp_loop_variable_4=ubound(x,4),lbound(x,4),-1
545 x(
546 + cp_loop_variable_1,
547 + cp_loop_variable_2,
548 + cp_loop_variable_3,
549 + cp_loop_variable_4
550 + )=
551 +cp_double(cp_double_pointer)
552 cp_double_pointer=cp_double_pointer-1
553 end do
554 end do
555 end do
556 end do
557 end subroutine
558
559 subroutine cp_arg_restore_real_four_tensor_a(x,
560 +cp_loop_variable_1,
561 +cp_loop_variable_2,
562 +cp_loop_variable_3,
563 +cp_loop_variable_4
564 +)
565 C $OpenAD$ INLINE DECLS
566 implicit none
567 double precision, dimension(::) :: x
568 C $OpenAD$ END DECLS
569 do cp_loop_variable_1=ubound(x,1),lbound(x,1),-1
570 do cp_loop_variable_2=ubound(x,2),lbound(x,2),-1
571 do cp_loop_variable_3=ubound(x,3),lbound(x,3),-1
572 do cp_loop_variable_4=ubound(x,4),lbound(x,4),-1
573 x(
574 + cp_loop_variable_1,
575 + cp_loop_variable_2,
576 + cp_loop_variable_3,
577 + cp_loop_variable_4
578 + )%v=
579 +cp_double(cp_double_pointer)
580 cp_double_pointer=cp_double_pointer-1
581 end do
582 end do
583 end do
584 end do
585 end subroutine
586
587 subroutine cp_arg_store_real_five_tensor(x,
588 +cp_loop_variable_1,
589 +cp_loop_variable_2,
590 +cp_loop_variable_3,
591 +cp_loop_variable_4,
592 +cp_loop_variable_5
593 +)
594 C $OpenAD$ INLINE DECLS
595 implicit none
596 double precision, dimension(::) :: x
597 C $OpenAD$ END DECLS
598 do cp_loop_variable_1=lbound(x,1),ubound(x,1)
599 do cp_loop_variable_2=lbound(x,2),ubound(x,2)
600 do cp_loop_variable_3=lbound(x,3),ubound(x,3)
601 do cp_loop_variable_4=lbound(x,4),ubound(x,4)
602 do while (cp_double_size .lt.
603 +cp_double_pointer+ubound(x,5)-lbound(x,5))
604 allocate(cp_double_tmp(cp_double_size))
605 cp_double_tmp=cp_double
606 deallocate(cp_double)
607 allocate(cp_double(cp_double_size*2))
608 print *,'CPD+'
609 cp_double(1:cp_double_size) = cp_double_tmp
610 deallocate(cp_double_tmp)
611 cp_double_size=cp_double_size*2
612 end do
613 do cp_loop_variable_5=lbound(x,5),ubound(x,5)
614 cp_double_pointer=cp_double_pointer+1
615 cp_double(cp_double_pointer)=
616 +x(
617 + cp_loop_variable_1,
618 + cp_loop_variable_2,
619 + cp_loop_variable_3,
620 + cp_loop_variable_4,
621 + cp_loop_variable_5
622 + )
623 end do
624 end do
625 end do
626 end do
627 end do
628 end subroutine
629
630 subroutine cp_arg_store_real_five_tensor_a(x,
631 +cp_loop_variable_1,
632 +cp_loop_variable_2,
633 +cp_loop_variable_3,
634 +cp_loop_variable_4,
635 +cp_loop_variable_5
636 +)
637 C $OpenAD$ INLINE DECLS
638 implicit none
639 double precision, dimension(::) :: x
640 C $OpenAD$ END DECLS
641 do cp_loop_variable_1=lbound(x,1),ubound(x,1)
642 do cp_loop_variable_2=lbound(x,2),ubound(x,2)
643 do cp_loop_variable_3=lbound(x,3),ubound(x,3)
644 do cp_loop_variable_4=lbound(x,4),ubound(x,4)
645 do while (cp_double_size .lt.
646 +cp_double_pointer+ubound(x,5)-lbound(x,5))
647 allocate(cp_double_tmp(cp_double_size))
648 cp_double_tmp=cp_double
649 deallocate(cp_double)
650 allocate(cp_double(cp_double_size*2))
651 print *,'CPD+'
652 cp_double(1:cp_double_size) = cp_double_tmp
653 deallocate(cp_double_tmp)
654 cp_double_size=cp_double_size*2
655 end do
656 do cp_loop_variable_5=lbound(x,5),ubound(x,5)
657 cp_double_pointer=cp_double_pointer+1
658 cp_double(cp_double_pointer)=
659 +x(
660 + cp_loop_variable_1,
661 + cp_loop_variable_2,
662 + cp_loop_variable_3,
663 + cp_loop_variable_4,
664 + cp_loop_variable_5
665 + )%v
666 end do
667 end do
668 end do
669 end do
670 end do
671 end subroutine
672
673 subroutine cp_arg_restore_real_five_tensor(x,
674 +cp_loop_variable_1,
675 +cp_loop_variable_2,
676 +cp_loop_variable_3,
677 +cp_loop_variable_4,
678 +cp_loop_variable_5
679 +)
680 C $OpenAD$ INLINE DECLS
681 implicit none
682 double precision, dimension(::) :: x
683 C $OpenAD$ END DECLS
684 do cp_loop_variable_1=ubound(x,1),lbound(x,1),-1
685 do cp_loop_variable_2=ubound(x,2),lbound(x,2),-1
686 do cp_loop_variable_3=ubound(x,3),lbound(x,3),-1
687 do cp_loop_variable_4=ubound(x,4),lbound(x,4),-1
688 do cp_loop_variable_5=ubound(x,5),lbound(x,5),-1
689 x(
690 + cp_loop_variable_1,
691 + cp_loop_variable_2,
692 + cp_loop_variable_3,
693 + cp_loop_variable_4,
694 + cp_loop_variable_5
695 + )=
696 +cp_double(cp_double_pointer)
697 cp_double_pointer=cp_double_pointer-1
698 end do
699 end do
700 end do
701 end do
702 end do
703 end subroutine
704
705 subroutine cp_arg_restore_real_five_tensor_a(x,
706 +cp_loop_variable_1,
707 +cp_loop_variable_2,
708 +cp_loop_variable_3,
709 +cp_loop_variable_4,
710 +cp_loop_variable_5
711 +)
712 C $OpenAD$ INLINE DECLS
713 implicit none
714 double precision, dimension(::) :: x
715 C $OpenAD$ END DECLS
716 do cp_loop_variable_1=ubound(x,1),lbound(x,1),-1
717 do cp_loop_variable_2=ubound(x,2),lbound(x,2),-1
718 do cp_loop_variable_3=ubound(x,3),lbound(x,3),-1
719 do cp_loop_variable_4=ubound(x,4),lbound(x,4),-1
720 do cp_loop_variable_5=ubound(x,5),lbound(x,5),-1
721 x(
722 + cp_loop_variable_1,
723 + cp_loop_variable_2,
724 + cp_loop_variable_3,
725 + cp_loop_variable_4,
726 + cp_loop_variable_5
727 + )%v=
728 +cp_double(cp_double_pointer)
729 cp_double_pointer=cp_double_pointer-1
730 end do
731 end do
732 end do
733 end do
734 end do
735 end subroutine
736
737
738 C integers -----------------------------------------------------
739 subroutine cp_arg_store_integer_scalar(i)
740 C $OpenAD$ INLINE DECLS
741 implicit none
742 integer :: i
743 C $OpenAD$ END DECLS
744 if(cp_integer_size .lt. cp_integer_pointer+1) then
745 allocate(cp_integer_tmp(cp_integer_size))
746 cp_integer_tmp=cp_integer
747 deallocate(cp_integer)
748 allocate(cp_integer(cp_integer_size*2))
749 print *,'CPI+'
750 cp_integer(1:cp_integer_size) = cp_integer_tmp
751 deallocate(cp_integer_tmp)
752 cp_integer_size=cp_integer_size*2
753 end if
754 cp_integer_pointer=cp_integer_pointer+1
755 cp_integer(cp_integer_pointer)=i
756 end subroutine
757
758 subroutine cp_arg_restore_integer_scalar(i)
759 C $OpenAD$ INLINE DECLS
760 implicit none
761 integer :: i
762 C $OpenAD$ END DECLS
763 i=cp_integer(cp_integer_pointer)
764 cp_integer_pointer=cp_integer_pointer-1
765 end subroutine
766
767 subroutine cp_arg_store_integer_vector(x,cp_loop_variable_1)
768 C $OpenAD$ INLINE DECLS
769 implicit none
770 integer, dimension(:) :: x
771 C $OpenAD$ END DECLS
772 do while (cp_integer_size .lt.
773 +cp_integer_pointer+ubound(x,1)-lbound(x,1))
774 allocate(cp_integer_tmp(cp_integer_size))
775 cp_integer_tmp=cp_integer
776 deallocate(cp_integer)
777 allocate(cp_integer(cp_integer_size*2))
778 print *,'CPI+'
779 cp_integer(1:cp_integer_size) = cp_integer_tmp
780 deallocate(cp_integer_tmp)
781 cp_integer_size=cp_integer_size*2
782 end do
783 do cp_loop_variable_1=lbound(x,1), ubound(x,1), 1
784 cp_integer_pointer=cp_integer_pointer+1
785 cp_integer(cp_integer_pointer)=
786 +x(cp_loop_variable_1)
787 end do
788 end subroutine
789
790 subroutine cp_arg_restore_integer_vector(x,cp_loop_variable_1)
791 C $OpenAD$ INLINE DECLS
792 implicit none
793 integer, dimension(:) :: x
794 C $OpenAD$ END DECLS
795 do cp_loop_variable_1=ubound(x,1),lbound(x,1),-1
796 x(cp_loop_variable_1)=cp_integer(cp_integer_pointer)
797 cp_integer_pointer=cp_integer_pointer-1
798 end do
799 end subroutine
800
801 subroutine cp_arg_store_integer_three_tensor(x,
802 +cp_loop_variable_1,
803 +cp_loop_variable_2,
804 +cp_loop_variable_3
805 +)
806 C $OpenAD$ INLINE DECLS
807 implicit none
808 integer, dimension(::) :: x
809 C $OpenAD$ END DECLS
810 do cp_loop_variable_1=lbound(x,1),ubound(x,1)
811 do cp_loop_variable_2=lbound(x,2),ubound(x,2)
812 do while (cp_integer_size .lt.
813 +cp_integer_pointer+ubound(x,3)-lbound(x,3))
814 allocate(cp_integer_tmp(cp_integer_size))
815 cp_integer_tmp=cp_integer
816 deallocate(cp_integer)
817 allocate(cp_integer(cp_integer_size*2))
818 print *,'CPD+'
819 cp_integer(1:cp_integer_size) = cp_integer_tmp
820 deallocate(cp_integer_tmp)
821 cp_integer_size=cp_integer_size*2
822 end do
823 do cp_loop_variable_3=lbound(x,3),ubound(x,3)
824 cp_integer_pointer=cp_integer_pointer+1
825 cp_integer(cp_integer_pointer)=
826 +x(
827 + cp_loop_variable_1,
828 + cp_loop_variable_2,
829 + cp_loop_variable_3
830 + )
831 end do
832 end do
833 end do
834 end subroutine
835
836 subroutine cp_arg_restore_integer_three_tensor(x,
837 +cp_loop_variable_1,
838 +cp_loop_variable_2,
839 +cp_loop_variable_3
840 +)
841 C $OpenAD$ INLINE DECLS
842 implicit none
843 integer, dimension(::) :: x
844 C $OpenAD$ END DECLS
845 do cp_loop_variable_1=ubound(x,1),lbound(x,1),-1
846 do cp_loop_variable_2=ubound(x,2),lbound(x,2),-1
847 do cp_loop_variable_3=ubound(x,3),lbound(x,3),-1
848 x(
849 + cp_loop_variable_1,
850 + cp_loop_variable_2,
851 + cp_loop_variable_3
852 + )=
853 +cp_integer(cp_integer_pointer)
854 cp_integer_pointer=cp_integer_pointer-1
855 end do
856 end do
857 end do
858 end subroutine
859
860 subroutine cp_arg_store_integer_four_tensor(x,
861 +cp_loop_variable_1,
862 +cp_loop_variable_2,
863 +cp_loop_variable_3,
864 +cp_loop_variable_4
865 +)
866 C $OpenAD$ INLINE DECLS
867 implicit none
868 integer, dimension(::) :: x
869 C $OpenAD$ END DECLS
870 do cp_loop_variable_1=lbound(x,1),ubound(x,1)
871 do cp_loop_variable_2=lbound(x,2),ubound(x,2)
872 do cp_loop_variable_3=lbound(x,3),ubound(x,3)
873 do while (cp_integer_size .lt.
874 +cp_integer_pointer+ubound(x,4)-lbound(x,4))
875 allocate(cp_integer_tmp(cp_integer_size))
876 cp_integer_tmp=cp_integer
877 deallocate(cp_integer)
878 allocate(cp_integer(cp_integer_size*2))
879 print *,'CPD+'
880 cp_integer(1:cp_integer_size) = cp_integer_tmp
881 deallocate(cp_integer_tmp)
882 cp_integer_size=cp_integer_size*2
883 end do
884 do cp_loop_variable_4=lbound(x,4),ubound(x,4)
885 cp_integer_pointer=cp_integer_pointer+1
886 cp_integer(cp_integer_pointer)=
887 +x(
888 + cp_loop_variable_1,
889 + cp_loop_variable_2,
890 + cp_loop_variable_3,
891 + cp_loop_variable_4
892 + )
893 end do
894 end do
895 end do
896 end do
897 end subroutine
898
899 subroutine cp_arg_restore_integer_four_tensor(x,
900 +cp_loop_variable_1,
901 +cp_loop_variable_2,
902 +cp_loop_variable_3,
903 +cp_loop_variable_4
904 +)
905 C $OpenAD$ INLINE DECLS
906 implicit none
907 integer, dimension(::) :: x
908 C $OpenAD$ END DECLS
909 do cp_loop_variable_1=ubound(x,1),lbound(x,1),-1
910 do cp_loop_variable_2=ubound(x,2),lbound(x,2),-1
911 do cp_loop_variable_3=ubound(x,3),lbound(x,3),-1
912 do cp_loop_variable_4=ubound(x,4),lbound(x,4),-1
913 x(
914 + cp_loop_variable_1,
915 + cp_loop_variable_2,
916 + cp_loop_variable_3,
917 + cp_loop_variable_4
918 + )=
919 +cp_integer(cp_integer_pointer)
920 cp_integer_pointer=cp_integer_pointer-1
921 end do
922 end do
923 end do
924 end do
925 end subroutine
926
927 subroutine cp_arg_store_integer_five_tensor(x,
928 +cp_loop_variable_1,
929 +cp_loop_variable_2,
930 +cp_loop_variable_3,
931 +cp_loop_variable_4,
932 +cp_loop_variable_5
933 +)
934 C $OpenAD$ INLINE DECLS
935 implicit none
936 integer, dimension(::) :: x
937 C $OpenAD$ END DECLS
938 do cp_loop_variable_1=lbound(x,1),ubound(x,1)
939 do cp_loop_variable_2=lbound(x,2),ubound(x,2)
940 do cp_loop_variable_3=lbound(x,3),ubound(x,3)
941 do cp_loop_variable_4=lbound(x,4),ubound(x,4)
942 do while (cp_integer_size .lt.
943 +cp_integer_pointer+ubound(x,5)-lbound(x,5))
944 allocate(cp_integer_tmp(cp_integer_size))
945 cp_integer_tmp=cp_integer
946 deallocate(cp_integer)
947 allocate(cp_integer(cp_integer_size*2))
948 print *,'CPD+'
949 cp_integer(1:cp_integer_size) = cp_integer_tmp
950 deallocate(cp_integer_tmp)
951 cp_integer_size=cp_integer_size*2
952 end do
953 do cp_loop_variable_5=lbound(x,5),ubound(x,5)
954 cp_integer_pointer=cp_integer_pointer+1
955 cp_integer(cp_integer_pointer)=
956 +x(
957 + cp_loop_variable_1,
958 + cp_loop_variable_2,
959 + cp_loop_variable_3,
960 + cp_loop_variable_4,
961 + cp_loop_variable_5
962 + )
963 end do
964 end do
965 end do
966 end do
967 end do
968 end subroutine
969
970 subroutine cp_arg_restore_integer_five_tensor(x,
971 +cp_loop_variable_1,
972 +cp_loop_variable_2,
973 +cp_loop_variable_3,
974 +cp_loop_variable_4,
975 +cp_loop_variable_5
976 +)
977 C $OpenAD$ INLINE DECLS
978 implicit none
979 integer, dimension(::) :: x
980 C $OpenAD$ END DECLS
981 do cp_loop_variable_1=ubound(x,1),lbound(x,1),-1
982 do cp_loop_variable_2=ubound(x,2),lbound(x,2),-1
983 do cp_loop_variable_3=ubound(x,3),lbound(x,3),-1
984 do cp_loop_variable_4=ubound(x,4),lbound(x,4),-1
985 do cp_loop_variable_5=ubound(x,5),lbound(x,5),-1
986 x(
987 + cp_loop_variable_1,
988 + cp_loop_variable_2,
989 + cp_loop_variable_3,
990 + cp_loop_variable_4,
991 + cp_loop_variable_5
992 + )=
993 +cp_integer(cp_integer_pointer)
994 cp_integer_pointer=cp_integer_pointer-1
995 end do
996 end do
997 end do
998 end do
999 end do
1000 end subroutine
1001
1002 C strings -----------------------------------------------------
1003 subroutine cp_arg_store_string_scalar(s)
1004 C $OpenAD$ INLINE DECLS
1005 implicit none
1006 character*(80) :: s
1007 C $OpenAD$ END DECLS
1008 if(cp_string_size .lt. cp_string_pointer+1) then
1009 allocate(cp_string_tmp(cp_string_size))
1010 cp_string_tmp=cp_string
1011 deallocate(cp_string)
1012 allocate(cp_string(cp_string_size*2))
1013 print *,'CPS+'
1014 cp_string(1:cp_string_size) = cp_string_tmp
1015 deallocate(cp_string_tmp)
1016 cp_string_size=cp_string_size*2
1017 end if
1018 cp_string_pointer=cp_string_pointer+1
1019 cp_string(cp_string_pointer)=s
1020 end subroutine
1021
1022 subroutine cp_arg_restore_string_scalar(s)
1023 C $OpenAD$ INLINE DECLS
1024 implicit none
1025 character*(80) :: s
1026 C $OpenAD$ END DECLS
1027 s=cp_string(cp_string_pointer)
1028 cp_string_pointer=cp_string_pointer-1
1029 end subroutine
1030
1031 C bools -----------------------------------------------------
1032 subroutine cp_arg_store_bool_scalar(b)
1033 C $OpenAD$ INLINE DECLS
1034 implicit none
1035 logical :: b
1036 C $OpenAD$ END DECLS
1037 if(cp_boolean_size .lt. cp_boolean_pointer+1) then
1038 allocate(cp_boolean_tmp(cp_boolean_size))
1039 cp_boolean_tmp=cp_boolean
1040 deallocate(cp_boolean)
1041 allocate(cp_boolean(cp_boolean_size*2))
1042 print *,'CPB+'
1043 cp_boolean(1:cp_boolean_size) = cp_boolean_tmp
1044 deallocate(cp_boolean_tmp)
1045 cp_boolean_size=cp_boolean_size*2
1046 end if
1047 cp_boolean_pointer=cp_boolean_pointer+1
1048 cp_boolean(cp_boolean_pointer)=b
1049 end subroutine
1050
1051 subroutine cp_arg_restore_bool_scalar(b)
1052 C $OpenAD$ INLINE DECLS
1053 implicit none
1054 logical :: b
1055 C $OpenAD$ END DECLS
1056 b=cp_boolean(cp_boolean_pointer)
1057 cp_boolean_pointer=cp_boolean_pointer-1
1058 end subroutine

  ViewVC Help
Powered by ViewVC 1.1.22