Intel Fortran, dislin, plotting

Good morning everyone,

I finally succeeded in making dislin work with Intel Fortran.
I succesfully compiled an example from Chivers ‘Introduction to progamming in Fortran’
As a result I obtain a .met metafile.
How can I plot this data or with what command do I send the results to a ps or pdf file.
I searched in the docs but the documentation is not very transparent for a beginner like me.
Thx.

Roger

1 Like

DISLIN is a high-level plotting library.

I’m aware of that.
This is the program:

program ch41_dislin_01
  use dislin
  implicit none
  integer :: i, j
! Total number of processors and hence data
! points
  integer, parameter :: nprocs = 8
! Number of percentage values from
! 10% -> 90% 9
! 95% 1
! Total 10
  integer, parameter :: nn = 10
  real, dimension (nn) :: pp = (/ 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 0.95 /)
  real, dimension (nprocs) :: x
  real, dimension (nprocs) :: y
  real, dimension (nprocs, nn) :: ydata
  integer :: nx
  integer :: ny
  character *30 cbuf

  do i = 1, nprocs
    x(i) = real(i)
  end do
! Amdahl calculations. Store in 2 d array and
! then
! assign to 1 d array for plotting.
  do i = 1, nprocs
    do j = 1, nn
      ydata(i, j) = 1/((1-pp(j))+pp(j)/i)
    end do
  end do
! Write the data to a file for verification
! purposes
  open (unit=10, file='amdahl_table_08.txt')
  do i = 1, nprocs
    write (unit=10, fmt=100) x(i), ydata(i, 1:nn)
100 format (11(f7.2,2x))
  end do
  close (10)
  call disini
  call complx
  call axspos(450, 1800)
  call axslen(2200, 1400)
  call name('Number of processors', 'x')
  call name('Speed up', 'y')
  call titlin('Plot of Amdahls Law', 1)
  call titlin('8 Processors', 3)
  call labdig(-1, 'x')
  call ticks(10, 'xy')
  call graf(1.0, 8.0, 1.0, 1.0, 1.0, 7.0, 1.0, 1.0)
  call title
  call xaxgit
  call chncrv('line')
! Plot the curves. Copy from 2 d array to 1 d
! array
! before the call to curve.
  do i = 1, nn
    y = ydata(1:nprocs, i)
    call curve(x, y, nprocs)
  end do
  call legini(cbuf, 10, 3)
! Coordinates of the start of the legend
! for the curves.
  nx = 500
  ny = 450
  call legpos(nx, ny)
  call leglin(cbuf, '10%', 1)
  call leglin(cbuf, '20%', 2)
  call leglin(cbuf, '30%', 3)
  call leglin(cbuf, '40%', 4)
  call leglin(cbuf, '50%', 5)
  call leglin(cbuf, '60%', 6)
  call leglin(cbuf, '70%', 7)
  call leglin(cbuf, '80%', 8)
  call leglin(cbuf, '90%', 9)
  call leglin(cbuf, '95%', 10)
  call legtit('legend')
  call legend(cbuf, 3)
  call disfin
end program

As a result I get a met file: ‘dislin.met’ and a text file ‘amdahl_table.txt’.
I suppose the met file contains all the information to generate a plot.
My question is: how can I produce a plot. I tried call metafl(‘PDF’) to no avail.

Roger

When you’ve compiled and ran a program a .met file will be created. dislin provide a utility program that can be use to display the plot or generate a so called device file.

Here are some sample runs

Display to the screen

disdrv dislin_2.met CONS

Generate a poscript file

disdrv dislin_2.met PS

Generate a pdf

disdrv dislin_2.met PDF

Hope this helps

Ian Chivers

Where did you add the call to METAFL?
I added

call metafl('pdf')

before the call to DISINI() in your source file listed above, then built the program using IFX and ran it. The program produced a file “dislin.pdf”.

Thank you all for your comments.
It worked. I got a nice


plot in PDF.
Fortran is cool!

Roger

2 Likes