12.07.2015 Views

PGI User's Guide

PGI User's Guide

PGI User's Guide

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Portability of Multi-Threaded Programs on LinuxTiming functions available with the <strong>PGI</strong> compilers include these:• 3F timing routines• The SECNDS pre-declared function in PGF77, PGF95, or PGFORTRAN• The SYSTEM_CLOCK or CPU_CLOCK intrinsics in PGF95 or PGHPF.In general, when timing a program, you should try to eliminate or reduce the amount of system level activitiessuch as I/O, program loading, and task switching.The following example shows a fragment that indicates how to use SYSTEM_CLOCK effectively within an F90,F95 or HPF program unit.Example 3.4. Using SYSTEM_CLOCK code fragment. . .integer :: nprocs, hz, clock0, clock1real :: timeinteger, allocatable :: t(:)!hpf$ distribute t(cyclic)#if defined (HPF)allocate (t(number_of_processors()))#elif defined (_OPENMP)allocate (t(OMP_GET_NUM_THREADS()))#elseallocate (t(1))#endifcall system_clock (count_rate=hz)!call system_clock(count=clock0)< do work>call system_clock(count=clock1)!t = (clock1 - clock0)time = real (sum(t)) / (real(hz) * size(t)). . .Portability of Multi-Threaded Programs on Linux<strong>PGI</strong> has created two libraries - libpgbind and libnuma - to handle the variations between variousimplementations of Linux.Some older versions of Linux are lacking certain features that support multi-processor and multi-core systems,in particular, the system call 'sched_setaffinity' and the numa library libnuma. The <strong>PGI</strong> run-time library usesthese features to implement some –Mconcur and –mp operations.These variations have led to the creation of two <strong>PGI</strong> libraries, libpgbind and libnuma. These libraries are usedon all 32-bit and 64-bit Linux systems, but are not needed on Windows or Mac OS X.When a program is linked with the system libnuma library, the program depends on the libnuma library inorder to run. On systems without a system libnuma library, the <strong>PGI</strong> version of libnuma provides the requiredstubs so that the program links and executes properly.46

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!