This directory (/CODE) contains the following:

NOTE: The reason for creating this library is to allow the programmer to use the functions/classes declared and defined therein in any of the programs written throughout the book.

A Note Concerning Compilers, Compilation and Navigation

In the writing of this software, every attempt has been made to conform to the ANSI C++ standard.  Software development and testing were performed on an Intel processor based PC running Redhat Linux version 8.0.  Compilation was accomplished using the GNU gcc 3.2 compiler.  Although some compilation tests were accomplished using native compilers under AIX, IRIX and SunOS operating systems, proper compilation and execution are not guaranteed.  No compilation tests were performed under the Microsoft Windows or Macintosh operating systems.

Navigation of this CD has been tested under both the Linux and the Microsoft Windows operating systems.

A Note to Macintosh Users
: Mac OS X is required for properly navigating this CD.  Prior versions of the Mac operating system appear to interpret the filenames on this CD using the 8.3 character convention, and hence filenames with the first eight characters being identical are not distinguishable.

Compilation of SCmathlib for Serial Programs


    (1) Enter the directory CODE.  If you do a directory listing, you should see a file called Makefile.

    (2) type:  gmake

    After hitting return, you should see something similar (depending on what system you are running on) to the following:

    g++ -O3  -c SCmathlib.cpp
    g++ -O3  -c SCchapter2.cpp
    g++ -O3  -c SCchapter3.cpp
    g++ -O3  -c SCchapter4.cpp
    g++ -O3  -c SCchapter5.cpp
    g++ -O3  -c SCchapter6.cpp
    g++ -O3  -c SCchapter7.cpp
    g++ -O3  -c SCchapter8.cpp
    g++ -O3  -c SCchapter9.cpp
    ar rv libSCmathlib.a  SCmathlib.o  SCchapter2.o  SCchapter3.o
       SCchapter4.o  SCchapter5.o  SCchapter6.o  SCchapter7.o
       SCchapter8.o  SCchapter9.o
    a - SCmathlib.o
    a - SCchapter2.o
    a - SCchapter3.o
    a - SCchapter4.o
    a - SCchapter5.o
    a - SCchapter6.o
    a - SCchapter7.o
    a - SCchapter8.o
    a - SCchapter9.o

    (3) If you now do a directory listing, you should see that the file libSCmathlib.a has been created.


  Compilation of SCmathlib for Parallel Programs

    (1) Enter the directory CODE.  If you do a directory listing, you should see a file called Makefile.

    (2) type:  gmake MPISRC=1

    After hitting return, you should see something similar (depending on what system you are running on) to the following:

    g++ -O3 -DMPISRC -c SCmathlib.cpp
    g++ -O3 -DMPISRC -c SCchapter2.cpp
    g++ -O3 -DMPISRC -c SCchapter3.cpp
    g++ -O3 -DMPISRC -c SCchapter4.cpp
    g++ -O3 -DMPISRC -c SCchapter5.cpp
    g++ -O3 -DMPISRC -c SCchapter6.cpp
    g++ -O3 -DMPISRC -c SCchapter7.cpp
    g++ -O3 -DMPISRC -c SCchapter8.cpp
    g++ -O3 -DMPISRC -c SCchapter9.cpp
    ar rv libSCmathlibP.a  SCmathlib.o  SCchapter2.o  SCchapter3.o
       SCchapter4.o  SCchapter5.o  SCchapter6.o  SCchapter7.o
       SCchapter8.o  SCchapter9.o
    a - SCmathlib.o
    a - SCchapter2.o
    a - SCchapter3.o
    a - SCchapter4.o
    a - SCchapter5.o
    a - SCchapter6.o
    a - SCchapter7.o
    a - SCchapter8.o
    a - SCchapter9.o

    (3) If you now do a directory listing, you should see that the file libSCmathlibP.a has been created.


Serial Program Compilation Guide (from Appendix A)

For the purposes of this compilation example, we will assume that we are using the GNU g++ compiler to compile a C++ program we have written contained within the file myprog.cpp. In the following examples, the argument following the `-o' flag designates the file name to be used for the output. If no `-o' option is specified, most compilers default to using the name ``a.out''. We now present several different programming scenarios:

Parallel Program Compilation Guide (from Appendix B)

For the purposes of this compilation example, we will assume that we are using the GNU g++ compiler to compile a C++ program we have written contained within the file myprog.cpp. We will also assume that the machine on which you are trying to compile is a parallel machine with some version of MPI installed. You will need to contact your system administrator to find out the exact version of MPI that is available and the paths on your local architecture. In the following examples, the argument following the `-o' flag designates the file name to be used for the output. If no `-o' option is specified, most compilers default to using the name ``a.out''. We now present several different programming scenarios: You will need to contact your system administrator to verify the exact command used on your computing architecture to run an MPI program. In general, most architectures execute MPI programs in a fashion similar to the following:
mpirun -np 4 myprog
where mpirun is a special program used for starting execution on the parallel machine, `-np 4' indicates the number of processes requested, and myprog denotes the program executable compiled as discussed above.



A Note Concerning Makefiles

    For those new to the Unix programming environment, addition information concerning makefiles can be found both on the web and in many good books, one of which is Managing Projects with make by Andrew Oram and Steve Talbott.  Another useful source of information for gmake (GNU make, which is used above) and g++ (the GNU C++ compiler) is the GNU website, www.gnu.org.




A Note Concerning File Permissions

    Depending on how your system is configured, it may be necessary to change the directory and file permissions in order to compile within the  CODE directory.  If you do encounter permission problems, do the following:  change directory to the parent directory of the CODE directory (from which, under Unix, you can see the directory CODE by doing an 'ls').  Type the expression within quotes: "chmod -R 755 CODE".  This will set the directory CODE and all files and subdirectories to be owner-RWX (read/write/execute) and group and world RX (read/execute).