C taping -------------------------------------------- subroutine push(x) C $OpenAD$ INLINE DECLS double precision :: x C $OpenAD$ END DECLS if(double_tape_size .lt. double_tape_pointer) then print *, "DT+ ", double_tape_size allocate(double_tmp_tape(double_tape_size), +STAT=cp_loop_variable_1) if (cp_loop_variable_1 .gt. 0 ) then print *,'allocation (1)failed with', cp_loop_variable_1 stop end if double_tmp_tape=double_tape deallocate(double_tape) allocate(double_tape(double_tape_size+tape_increment), +STAT=cp_loop_variable_1) if (cp_loop_variable_1 .gt. 0 ) then print *,'allocation (2)failed with', cp_loop_variable_1 stop end if double_tape(1:double_tape_size) = double_tmp_tape deallocate(double_tmp_tape) double_tape_size=double_tape_size+tape_increment end if double_tape(double_tape_pointer)=x double_tape_pointer=double_tape_pointer+1 end subroutine subroutine pop(x) C $OpenAD$ INLINE DECLS double precision :: x C $OpenAD$ END DECLS double_tape_pointer=double_tape_pointer-1 x=double_tape(double_tape_pointer) end subroutine subroutine apush(x) C $OpenAD$ INLINE DECLS double precision :: x C $OpenAD$ END DECLS if(double_tape_size .lt. double_tape_pointer) then print *, "DT+ ", double_tape_size allocate(double_tmp_tape(double_tape_size), +STAT=cp_loop_variable_1) if (cp_loop_variable_1 .gt. 0 ) then print *,'allocation (1)failed with', cp_loop_variable_1 stop end if double_tmp_tape=double_tape deallocate(double_tape) allocate(double_tape(double_tape_size+tape_increment), +STAT=cp_loop_variable_1) if (cp_loop_variable_1 .gt. 0 ) then print *,'allocation (2)failed with', cp_loop_variable_1 stop end if double_tape(1:double_tape_size) = double_tmp_tape deallocate(double_tmp_tape) double_tape_size=double_tape_size+tape_increment end if double_tape(double_tape_pointer)=x%v double_tape_pointer=double_tape_pointer+1 end subroutine subroutine apop(x) C $OpenAD$ INLINE DECLS type(active):: x C $OpenAD$ END DECLS double_tape_pointer=double_tape_pointer-1 x%v=double_tape(double_tape_pointer) end subroutine subroutine push_i(x) C $OpenAD$ INLINE DECLS integer :: x C $OpenAD$ END DECLS if(integer_tape_size .lt. integer_tape_pointer) then print *, "IT+ ", integer_tape_size+tape_increment allocate(integer_tmp_tape(integer_tape_size), +STAT=cp_loop_variable_1) if (cp_loop_variable_1 .gt. 0 ) then print *,'allocation (1)failed with', cp_loop_variable_1 stop end if integer_tmp_tape=integer_tape deallocate(integer_tape) allocate(integer_tape(integer_tape_size+tape_increment), +STAT=cp_loop_variable_1) if (cp_loop_variable_1 .gt. 0 ) then print *,'allocation (2)failed with', cp_loop_variable_1 stop end if integer_tape(1:integer_tape_size) = integer_tmp_tape deallocate(integer_tmp_tape) integer_tape_size=integer_tape_size+tape_increment end if integer_tape(integer_tape_pointer)=x integer_tape_pointer=integer_tape_pointer+1 end subroutine subroutine pop_i(x) C $OpenAD$ INLINE DECLS use OpenAD_tape implicit none integer :: x C $OpenAD$ END DECLS integer_tape_pointer=integer_tape_pointer-1 x=integer_tape(integer_tape_pointer) end subroutine subroutine push_b(x) C $OpenAD$ INLINE DECLS logical :: x C $OpenAD$ END DECLS if(logical_tape_size .lt. logical_tape_pointer) then print *, "IT+ ", logical_tape_size+tape_increment allocate(logical_tmp_tape(logical_tape_size), +STAT=cp_loop_variable_1) if (cp_loop_variable_1 .gt. 0 ) then print *,'allocation (1)failed with', cp_loop_variable_1 stop end if logical_tmp_tape=logical_tape deallocate(logical_tape) allocate(logical_tape(logical_tape_size+tape_increment), +STAT=cp_loop_variable_1) if (cp_loop_variable_1 .gt. 0 ) then print *,'allocation (2)failed with', cp_loop_variable_1 stop end if logical_tape(1:logical_tape_size) = logical_tmp_tape deallocate(logical_tmp_tape) logical_tape_size=logical_tape_size+tape_increment end if logical_tape(logical_tape_pointer)=x logical_tape_pointer=logical_tape_pointer+1 end subroutine subroutine pop_b(x) C $OpenAD$ INLINE DECLS use OpenAD_tape implicit none logical :: x C $OpenAD$ END DECLS logical_tape_pointer=logical_tape_pointer-1 x=logical_tape(logical_tape_pointer) end subroutine subroutine push_s(x) C $OpenAD$ INLINE DECLS character*(80) :: x C $OpenAD$ END DECLS if(string_tape_size .lt. string_tape_pointer) then print *, "IT+ ", string_tape_size+tape_increment allocate(string_tmp_tape(string_tape_size), +STAT=cp_loop_variable_1) if (cp_loop_variable_1 .gt. 0 ) then print *,'allocation (1)failed with', cp_loop_variable_1 stop end if string_tmp_tape=string_tape deallocate(string_tape) allocate(string_tape(string_tape_size+tape_increment), +STAT=cp_loop_variable_1) if (cp_loop_variable_1 .gt. 0 ) then print *,'allocation (2)failed with', cp_loop_variable_1 stop end if string_tape(1:string_tape_size) = string_tmp_tape deallocate(string_tmp_tape) string_tape_size=string_tape_size+tape_increment end if string_tape(string_tape_pointer)=x string_tape_pointer=string_tape_pointer+1 end subroutine subroutine pop_s(x) C $OpenAD$ INLINE DECLS use OpenAD_tape implicit none character*(80) :: x C $OpenAD$ END DECLS string_tape_pointer=string_tape_pointer-1 x=string_tape(string_tape_pointer) end subroutine subroutine saxpy(a,x,y) C $OpenAD$ INLINE DECLS double precision, intent(in) :: a type(active), intent(in) :: x type(active), intent(inout) :: y C $OpenAD$ END DECLS y%d=y%d+x%d*a end subroutine subroutine zeroderiv(x) C $OpenAD$ INLINE DECLS type(active), intent(out) :: x C $OpenAD$ END DECLS x%d=0.0d0 end subroutine subroutine setderiv(y,x) C $OpenAD$ INLINE DECLS type(active), intent(out) :: x type(active), intent(in) :: y C $OpenAD$ END DECLS x%d=y%d end subroutine subroutine incderiv(y,x) C $OpenAD$ INLINE DECLS type(active), intent(out) :: x type(active), intent(in) :: y C $OpenAD$ END DECLS x%d=x%d+y%d end subroutine subroutine condinczeroderiv(y,x) C $OpenAD$ INLINE DECLS type(active), intent(out) :: x type(active), intent(in) :: y C $OpenAD$ END DECLS if (iaddr(y).ne.iaddr(x)) then x%d=x%d+y%d y%d=0 end if end subroutine C Checkpointing stuff --------------------------------------- C reals ----------------------------------------------------- subroutine cp_arg_store_real_scalar(x) C $OpenAD$ INLINE DECLS double precision :: x C $OpenAD$ END DECLS print *,'JU: cp write x ', x write(cp_io_unit) x end subroutine subroutine cp_arg_restore_real_scalar(x) C $OpenAD$ INLINE DECLS implicit none double precision :: x C $OpenAD$ END DECLS read(cp_io_unit) x print *,'JU: cp read x ', x end subroutine subroutine cp_arg_store_real_scalar_a(x) C $OpenAD$ INLINE DECLS double precision :: x C $OpenAD$ END DECLS print *,'JU: cp write x ', x%v write(cp_io_unit) x%v end subroutine subroutine cp_arg_restore_real_scalar_a(x) C $OpenAD$ INLINE DECLS implicit none double precision :: x C $OpenAD$ END DECLS read(cp_io_unit) x%v print *,'JU: cp read x ', x%v end subroutine subroutine cp_arg_store_real_vector(x) C $OpenAD$ INLINE DECLS implicit none double precision, dimension(:) :: x C $OpenAD$ END DECLS print *,'JU: cp write x ', x(1) write(cp_io_unit) x end subroutine subroutine cp_arg_restore_real_vector(x) C $OpenAD$ INLINE DECLS implicit none double precision, dimension(:) :: x C $OpenAD$ END DECLS read(cp_io_unit) x print *,'JU: cp read x ', x(1) end subroutine subroutine cp_arg_store_real_vector_a(x) C $OpenAD$ INLINE DECLS implicit none double precision, dimension(:) :: x C $OpenAD$ END DECLS print *,'JU: cp write x ', x(1)%v write(cp_io_unit) x%v end subroutine subroutine cp_arg_restore_real_vector_a(x) C $OpenAD$ INLINE DECLS implicit none double precision, dimension(:) :: x C $OpenAD$ END DECLS read(cp_io_unit) x%v print *,'JU: cp read x ', x(1)%v end subroutine subroutine cp_arg_store_real_matrix(x) C $OpenAD$ INLINE DECLS implicit none double precision, dimension(::) :: x C $OpenAD$ END DECLS print *,'JU: cp write x ', x(1,1) write(cp_io_unit) x end subroutine subroutine cp_arg_restore_real_matrix(x) C $OpenAD$ INLINE DECLS implicit none double precision, dimension(::) :: x C $OpenAD$ END DECLS read(cp_io_unit) x print *,'JU: cp read x ', x(1,1) end subroutine subroutine cp_arg_store_real_matrix_a(x) C $OpenAD$ INLINE DECLS implicit none double precision, dimension(::) :: x C $OpenAD$ END DECLS print *,'JU: cp write x ', x(1,1)%v write(cp_io_unit) x%v end subroutine subroutine cp_arg_restore_real_matrix_a(x) C $OpenAD$ INLINE DECLS implicit none double precision, dimension(::) :: x C $OpenAD$ END DECLS read(cp_io_unit) x%v print *,'JU: cp read x ', x(1.1)%v end subroutine subroutine cp_arg_store_real_three_tensor(x) C $OpenAD$ INLINE DECLS implicit none double precision, dimension(::) :: x C $OpenAD$ END DECLS print *,'JU: cp write x ', x(1,1,1) write(cp_io_unit) x end subroutine subroutine cp_arg_store_real_three_tensor_a(x) C $OpenAD$ INLINE DECLS implicit none double precision, dimension(::) :: x C $OpenAD$ END DECLS print *,'JU: cp write x ', x(1,1,1)%v write(cp_io_unit) x%v end subroutine subroutine cp_arg_restore_real_three_tensor(x) C $OpenAD$ INLINE DECLS implicit none double precision, dimension(::) :: x C $OpenAD$ END DECLS read(cp_io_unit) x print *,'JU: cp read x ', x(1,1,1) end subroutine subroutine cp_arg_restore_real_three_tensor_a(x) C $OpenAD$ INLINE DECLS implicit none double precision, dimension(::) :: x C $OpenAD$ END DECLS print *,'JU: cp read x ', x%v read(cp_io_unit) x%v end subroutine subroutine cp_arg_store_real_four_tensor(x) C $OpenAD$ INLINE DECLS implicit none double precision, dimension(::) :: x C $OpenAD$ END DECLS print *,'JU: cp write x ', x(1,1,1,1) write(cp_io_unit) x end subroutine subroutine cp_arg_store_real_four_tensor_a(x) C $OpenAD$ INLINE DECLS implicit none double precision, dimension(::) :: x C $OpenAD$ END DECLS print *,'JU: cp write x ', x(1,1,1,1)%v write(cp_io_unit) x%v end subroutine subroutine cp_arg_restore_real_four_tensor(x) C $OpenAD$ INLINE DECLS implicit none double precision, dimension(::) :: x C $OpenAD$ END DECLS read(cp_io_unit) x print *,'JU: cp read x ', x(1,1,1,1) end subroutine subroutine cp_arg_restore_real_four_tensor_a(x) C $OpenAD$ INLINE DECLS implicit none double precision, dimension(::) :: x C $OpenAD$ END DECLS read(cp_io_unit) x%v print *,'JU: cp read x ', x(1,1,1,1)%v end subroutine subroutine cp_arg_store_real_five_tensor(x) C $OpenAD$ INLINE DECLS implicit none double precision, dimension(::) :: x C $OpenAD$ END DECLS print *,'JU: cp write x ', x(1,1,1,1,1) write(cp_io_unit) x end subroutine subroutine cp_arg_store_real_five_tensor_a(x) C $OpenAD$ INLINE DECLS implicit none double precision, dimension(::) :: x C $OpenAD$ END DECLS print *,'JU: cp write x ', x(1,1,1,1,1)%v write(cp_io_unit) x%v end subroutine subroutine cp_arg_restore_real_five_tensor(x) C $OpenAD$ INLINE DECLS implicit none double precision, dimension(::) :: x C $OpenAD$ END DECLS read(cp_io_unit) x print *,'JU: cp read x ', x(1,1,1,1,1) end subroutine subroutine cp_arg_restore_real_five_tensor_a(x) C $OpenAD$ INLINE DECLS implicit none double precision, dimension(::) :: x C $OpenAD$ END DECLS read(cp_io_unit) x%v print *,'JU: cp read x ', x(1,1,1,1,1)%v end subroutine C integers ----------------------------------------------------- subroutine cp_arg_store_integer_scalar(x) C $OpenAD$ INLINE DECLS implicit none integer :: x C $OpenAD$ END DECLS print *,'JU: cp write x ', x write(cp_io_unit) x end subroutine subroutine cp_arg_restore_integer_scalar(x) C $OpenAD$ INLINE DECLS implicit none integer :: x C $OpenAD$ END DECLS read(cp_io_unit) x print *,'JU: cp read x ', x end subroutine subroutine cp_arg_store_integer_vector(x) C $OpenAD$ INLINE DECLS implicit none integer, dimension(:) :: x C $OpenAD$ END DECLS print *,'JU: cp write x ', x(1) write(cp_io_unit) x end subroutine subroutine cp_arg_restore_integer_vector(x) C $OpenAD$ INLINE DECLS implicit none integer, dimension(:) :: x C $OpenAD$ END DECLS read(cp_io_unit) x print *,'JU: cp read x ', x(1) end subroutine subroutine cp_arg_store_integer_three_tensor(x) C $OpenAD$ INLINE DECLS implicit none integer, dimension(::) :: x C $OpenAD$ END DECLS print *,'JU: cp write x ', x(1,1,1) write(cp_io_unit) x end subroutine subroutine cp_arg_restore_integer_three_tensor(x) C $OpenAD$ INLINE DECLS implicit none integer, dimension(::) :: x C $OpenAD$ END DECLS read(cp_io_unit) x print *,'JU: cp read x ', x(1,1,1) end subroutine subroutine cp_arg_store_integer_four_tensor(x) C $OpenAD$ INLINE DECLS implicit none integer, dimension(::) :: x C $OpenAD$ END DECLS print *,'JU: cp write x ', x(1,1,1,1) write(cp_io_unit) x end subroutine subroutine cp_arg_restore_integer_four_tensor(x) C $OpenAD$ INLINE DECLS implicit none integer, dimension(::) :: x C $OpenAD$ END DECLS read(cp_io_unit) x print *,'JU: cp read x ', x(1,1,1,1) end subroutine subroutine cp_arg_store_integer_five_tensor(x) C $OpenAD$ INLINE DECLS implicit none integer, dimension(::) :: x C $OpenAD$ END DECLS print *,'JU: cp write x ', x(1,1,1,1,1) write(cp_io_unit) x end subroutine subroutine cp_arg_restore_integer_five_tensor(x) C $OpenAD$ INLINE DECLS implicit none integer, dimension(::) :: x C $OpenAD$ END DECLS read (cp_io_unit) x print *,'JU: cp read x ', x(1,1,1,1,1) end subroutine C strings ----------------------------------------------------- subroutine cp_arg_store_string_scalar(x) C $OpenAD$ INLINE DECLS implicit none character*(80) :: x C $OpenAD$ END DECLS print *,'JU: cp write x ', x write(cp_io_unit) x end subroutine subroutine cp_arg_restore_string_scalar(x) C $OpenAD$ INLINE DECLS implicit none character*(80) :: x C $OpenAD$ END DECLS read (cp_io_unit) x print *,'JU: cp read x ', x end subroutine C bools ----------------------------------------------------- subroutine cp_arg_store_bool_scalar(x) C $OpenAD$ INLINE DECLS implicit none logical :: x C $OpenAD$ END DECLS print *,'JU: cp write x ', x write(cp_io_unit) x end subroutine subroutine cp_arg_restore_bool_scalar(x) C $OpenAD$ INLINE DECLS implicit none logical :: x C $OpenAD$ END DECLS read (cp_io_unit) x print *,'JU: cp read x ', x end subroutine