Appendix A. Libraries

The MIPSpro 7 Fortran 90 compiler works with the following other commands, intrinsic procedures, and library routines:

Miscellaneous Library Routines

The following list describes the library routines that are available with the MIPSpro 7 Fortran 90 compiler. See the individual man pages for more details.

  • FFIO routines (C routines used with the FFIO layers):

    • fffcntl(3c)

    • ffopen(3c)

    • ffpos(3c)

    • ffread(3c)

    • ffseek(3c)

  • Interface routines (job control routines that control program terminations or execute a shell command):

    • ABORT(3f)

    • EXIT(3f)

    • ISHELL(3f)

  • I/O routines to control input and output:

    • ASNCTL(3f)

    • ASNQFILE(3f)

    • ASSIGN(3f)

    • FLUSH(3f)

    • NUMBLKS(3f)

    • RNL(3f)

    • RNLECHO(3f)

    • RNLSKIP(3f)

    • RNLTYPE(3f)

    • WNL(3f)

    • WNLLINE(3f)

    • WNLLONG(3f)

  • Programming aids (routines for times and dates, packing and unpacking, and character argument counters):

    • SECOND(3f)

    • SECONDR(3f)

    • SYSCLOCK(3f)

    • TIMEF(3f)

  • Multiprocessing routines for Fortran. There are a suite of routines developed specifically for multiprocessing. For information on these routines, see the mp(3f) man page.

Library Functions

The Fortran library routines provide an interface from Fortran programs to the IRIX system functions. System functions are facilities that are provided by the IRIX system kernel directly, as opposed to functions that are supplied by library code loaded with your program.

Table A-1 summarizes the routines in the Fortran run-time library that can be used with the compiler. The table indicates PXF POSIX Library standard routines as recommended substitutions for IRIX system functions. See the individual man pages for details about each routine.

Table A-1. Summary of System Interface Library Routines

Function

Recommended

Purpose

abort

Abnormal termination

access

PXFACCESS

Determine accessibility of a file

acct

 

Enable/disable process accounting

alarm

PXFALARM

Execute a subroutine after a specified time

barrier

 

Perform barrier operations

blockproc

 

Block processes

brk

 

Change data segment space allocation

chdir

PXFCHDIR

Change default directory

chmod

PXFCHMOD

Change mode of a file

chown

PXFCHOWN

Change owner

chroot

PXFCHROOT

Change root directory for a command

close

 

Close a file descriptor

creat

PXFCREAT

Create or rewrite a file

ctime

 

Return system time

dtime

 

Return elapsed execution time

dup

 

Duplicate an open file descriptor

etime

 

Return elapsed execution time

exit

PXFFASTEXIT

Terminate process with status

fcntl

 

File control

fdate

 

Return date and time in an ASCII string

fgetc

 

Get a character from a logical unit

fork

PXFFORK

Create a copy of this process

fputc

 

Write a character to a Fortran logical unit

free_barrier

 

Free barrier

fseek

 

Reposition a file on a logical unit

fseek64

 

Reposition a file on a logical unit for 64-bit architecture

fstat

 

Get file status

ftell

 

Reposition a file on a logical unit

ftell64

 

Reposition a file on a logical unit for 64-bit architecture

gerror

 

Get system error messages

getarg

PXFGETARG

Return command line arguments

getc

 

Get a character from a logical unit

getcwd

PXFGETCWD

Get pathname of current working directory

getdents

 

Read directory entries

getegid

PXFGETEGID

Get effective group ID

gethostid

 

Get unique identifier of current host

getenv

PXFGETENV

Get value of environment variables

geteuid

PXFGETEUID

Get effective user ID

getgid

PXFGETGID

Get user or group ID of the caller

gethostname

 

Get current host ID

getlog

 

Get user's login name

getpgrp

PXFGETPGRP

Get process group ID

getpid

PXFGETPID

Get process ID

getppid

PXFGETPPID

Get parent process ID

getsockopt

 

Get options on sockets

getuid

PXFGETUID

Get user or group ID of caller

gmtime

 

Return system time

iargc

IPXFARGC

Return command line arguments

idate

 

Return date or time in numerical form

ierrno

 

Get system error messages

ioctl

 

Control device

isatty

PXFISATTY

Determine if unit is associated with tty

itime

 

Return date or time in numerical form

kill

PXFKILL

Send a signal to a process

link

PXFLINK

Make a link to an existing file

loc

 

Return the address of an object

lseek

 

Move read/write file pointer

lseek64

 

Move read/write file pointer for 64-bit architecture

lstat

 

Get file status

ltime

 

Return system time

m_fork

 

Create parallel processes

m_get_myid

 

Get task ID

m_get_numprocs

 

Get number of subtasks

m_kill_procs

 

Kill process

m_lock

 

Set global lock

m_next

 

Return value of counter

m_park_procs

 

Suspend child processes

m_rele_procs

 

Resume child processes

m_set_procs

 

Set number of subtasks

m_sync

 

Synchronize all threads

m_unlock

 

Unset a global lock

mkdir

 

Make a directory

mknod

 

Make a directory/file

mount

 

Mount a filesystem

new_barrier

 

Initialize a barrier structure

nice

 

Lower priority of a process

open

PXFOPEN

Open a file

oserror

 

Get/set system error

pause

PXFPAUSE

Suspend process until signal

perror

 

Get system error messages

pipe

 

Create an interprocess channel

plock

 

Lock process, test, or data in memory

prctl

 

Control processes

profil

 

Execution-time profile

ptrace

 

Process trace

putc

 

Write a character to a Fortran logical unit

putenv

 

Set environment variable

qsort

 

Quick sort

read

 

Read from a file descriptor

readlink

 

Read value of symbolic link

rename

PXFRENAME

Change the name of a file

rmdir

PXFRMDIR

Remove a directory

sbrk

 

Change data segment space allocation

schedctl

 

Call to scheduler control

send

 

Send a message to a socket

setblockproccnt

 

Set semaphore count

setgid

PXFSETGID

Set group ID

sethostid

 

Set current host ID

setoserror

 

Set system error

setpgrp

PXFSETPGRP

Set process group ID

setsockopt

 

Set options on sockets

setuid

PXFSETUID

Set user ID

sginap

 

Put process to sleep

sginap64

 

Put process to sleep in 64-bit environment

shmat

 

Attach shared memory

shmdt

 

Detach shared memory

sighold

 

Raise priority and hold signal

sigignore

 

Ignore signal

signal

 

Change the action for a signal

sigpause

 

Suspend until receive signal

sigrelse

 

Release signal and lower priority

sigset

 

Specify system signal handling

sleep

PXFSLEEP

Suspend execution for an interval

socket

 

Create an endpoint for communication TCP

sproc

 

Create a new share group process

stat

PXFSTAT

Get file status

stime

 

Set time

symlink

 

Make symbolic link

sync

 

Update superblock

sysmp

 

Control multiprocessing

sysmp64

 

Control multiprocessing in 64-bit environment

system

 

Issue a shell command

taskblock

 

Block tasks

taskcreate

 

Create a new task

taskctl

 

Control task

taskdestroy

 

Kill task

tasksetblockcnt

 

Set task semaphore count

taskunblock

 

Unblock task

time

PXFTIME

Return system time (must be declared EXTERNAL)

ttynam

 

Find name of terminal port

uadmin

 

Administrative control

ulimit

 

Get and set user limits

ulimit64

 

Get and set user limits in 64-bit architecture

umask

PXFUMASK

Get and set file creation mask

umount

 

Dismount a file system

unblockproc

 

Unblock processes

unlink

PXFUNLINK

Remove a directory entry

uscalloc

 

Shared memory allocator

uscalloc64

 

Shared memory allocator in 64-bit environment

uscas

 

Compare and swap operator

usclosepollsema

 

Detach file descriptor from a pollable semaphore

usconfig

 

Semaphore and lock configuration operations

uscpsema

 

Acquire a semaphore

uscsetlock

 

Unconditionally set lock

usctlsema

 

Semaphore control operations

usdumplock

 

Dump lock information

usdumpsema

 

Dump semaphore information

usfree

 

User shared memory allocation

usfreelock

 

Free a lock

usfreepollsema

 

Free a pollable semaphore

usfreesema

 

Free a semaphore

usgetinfo

 

Exchange information through an arena

usinit

 

Semaphore and lock initialize routine

usinitlock

 

Initialize a lock

usinitsema

 

Initialize a semaphore

usmalloc

 

Allocate shared memory

usmalloc64

 

Allocate shared memory in 64-bit environment

usmallopt

 

Control allocation algorithm

usnewlock

 

Allocate and initialize a lock

usnewpollsema

 

Allocate and initialize a pollable semaphore

usnewsema

 

Allocate and initialize a semaphore

usopenpollsema

 

Attach a file descriptor to a pollable semaphore

uspsema

 

Acquire a semaphore

usputinfo

 

Exchange information through an arena

usrealloc

 

User share memory allocation

usrealloc64

 

User share memory allocation in 64-bit environment

ussetlock

 

Set lock

ustestlock

 

Test lock

ustestsema

 

Return value of semaphore

usunsetlock

 

Unset lock

usvsema

 

Free a resource to a semaphore

uswsetlock

 

Set lock

wait

PXFWAIT

Wait for a process to terminate

write

 

Write to a file


Compatibility with sproc(2)

The parallelism used in Fortran is implemented using the sproc(2) system call. It is recommended that programs not attempt to use both !$OMP PARALLEL DO loops and sproc calls. It is possible, but there are several restrictions:

  • Any threads you create may not execute !$OMP PARALLEL DO loops; only the original thread is allowed to do this.

  • The calls to routines like mp_block and mp_destroy apply only to the threads created by mp_create or to those automatically created when the Fortran job starts; they have no effect on any user-defined threads.

  • Calls to routines such as m_get_numprocs do not apply to the threads created by the Fortran routines. However, the Fortran threads are ordinary subprocesses; using the kill routine with the arguments 0 and sig (for example, kill(0,sig)) to signal all members of the process group might kill threads used to execute !$OMP PARALLEL DO. If you choose to intercept the SIGCLD signal, you must be prepared to receive this signal when the threads used for the !$OMP PARALLEL DO loops exit; this occurs when mp_destroy is called or at program termination.

  • The m_fork call is implemented using sproc(2), so it is not legal to run m_fork on a family of processes that each subsequently executes !$OMP PARALLEL DO loops. Only the original thread can execute !$OMP PARALLEL DO loops.