Chapter 13. Programming in FORTRAN

Table of Contents
A simple example in FORTRAN
Create remote executable program
Client program in Fortran
An asynchronous call in FORTRAN

In this section, we explain how to program OmniRPC in FORTRAN. If you want to know more details about APIs, see Section FORTRAN API.

A simple example in FORTRAN

Let's think about this Fortran program. This program calculates the inner product of a matrix. The main program is called main.f, and ip.f is the subroutine that calculates the inner product.

main.f

      double precision a(10),b(10),r
      do i = 1,10
         a(i) = i
         b(i) = i+10
      end do
      call innerprod(10,a,b,r)
      write(*,*) 'result=',r
      end

ip.f

      subroutine innerprod(n,a,b,r)
      integer n
      double precision a(*),b(*),r
      integer i
      r = 0.0
      do i = 1,n
        r = r+a(i)*b(i)
      end do
      return
      end

Let's set this program to call the innerprod subroutine with OmniRPC.