After a program is debugged and tested using the emulator, it can be compiled to run production workloads. Currently, a CA program can be compiled for either the uniprocessor simulator running on a Sparc workstation or for the CM5. The Concert compiler first translates a CA program into C++ code and then invokes the Gnu g++ compiler to produce the final executable file.
In order to run the system, ensure that your path contains the
concert driver script, which is located in the directory
$CONCERT_ROOT_PATH/bin.
You can run the compiler either from the command line or from within
emacs. Running from the command line it operates much like the other batch
compilers such as gcc. The compiler is invoked with the command
concert, and it it prints out a short
message describing the available flags when invoked with the -h
option.
indigo-rilla > concert -h
Concert Compiler V2.0.1 Alpha Fri Feb 25 11:40:58 CST 1994
Bugs/comments to concert-bugs@red-herring.cs.uiuc.edu
Copyright (c) 1991, 1992, 1993, 1994
The University of Illinois Board of Trustees.
All Rights Reserved.
Usage: concert file file ... [-h] [-0] [-O2] [-g] [-p] [-C] [-L] [-I] [-e]
-h print this list
-O optimize CA
-O2 optimize c++ (g++ -O2)
-g debugging information
-p profiling information
-C output c++ but do not compile
-I lisp interactive mode
-L assume happenstance locality
-e emulator
The following shows the compilation of the fib program for the uniprocessor simulator from the command line.
indigo-rilla > concert fib-example.ca Concert Compiler V2.0.1 Alpha Fri Feb 25 11:40:58 CST 1994 Bugs/comments to concert-bugs@red-herring.cs.uiuc.edu Copyright (c) 1991, 1992, 1993, 1994 The University of Illinois Board of Trustees. All Rights Reserved. Input and Attribute Evaluation Reading: /b/ca/concert2.0.1/lib/standard-prologue.ca... ...Closing: /b/ca/concert2.0.1/lib/standard-prologue.ca Reading: fib-example.ca... ...Closing: fib-example.ca Core Code Translation Dominator Computation Control Dependence Computation Static Single Assignment Conversion Type Inference Type Inference pass 1 Program Transformations Output Compilation Complete 27 Methods Output of 154 Compiled in 17 Classes Compiling C++ Code g++ -pipe -I/b/ca/concert2.0.1//include -o fib-example.ca.1.o -c fib-example.ca.1.cc g++ -pipe -I/b/ca/concert2.0.1//include -o fib-example.ca.o -c fib-example.ca.cc g++ -pipe -o fib-example.ca.exec fib-example.ca.1.o fib-example.ca.o /b/ca/concert2.0.1//lib/librt_uni.a /b/ca/concert2.0.1//lib/libg++.a -lm indigo-rilla >
Note that there appears to be two source files: the given one and standard-prologue.ca. This second file contains the definitions of built in Concurrent Aggregates primitives. Once the compiler has successfully compiled a program, it generates several files. They are the executable program, the intermediate files containing the C++ intermediate code, and the object files. For a input program, filename, the compiler produces:
Running the .exec file executes the CA program. The result and the CPU time are displayed. Note that this time is the total processor time for the simulator, and so has nothing in particular to do with the program's execution time on a parallel machine. Below shows an execution of the fib program compiled previously.
indigo-rilla > fib-example.ca.exec 89 program took 0.080000 seconds -----------------------------------------------------------
In order to generate and run CM5 executables, ensure that the concertCM5 driver script, which is also located in $CONCERT_ROOT_PATH/bin, is in your path. The only difference in compiling for SUN workstations and the CM5 is that the user program is linked to different runtime libraries. The procedure for generating an executable for the CM5 is as follows:
Usage: concertCM5 [-O2] ca-file1 ca-file2 ...
The `-O2' option allows use of g++ optimizer.
Besides the -e option discussed previously, the Concert compiler has several additional options to control optimization levels and output files.
The compiler has three optimization levels. The first level, the default, is no optimization. This is the quickest way (outside of the emulator) to get a program to run, however, the resulting program will run relatively slowly.
The second level of optimization, using the -O flag, causes the Concert compiler to optimize the Concurrent Aggregates program before it generates C++ code. One of the feature of such optimization is an incremental type inference system. Depending on the use of object-oriented features of the language (particularly polymorphism) good type inference may involve several passes and hence more time. In addition, large programs may require lots of memory to optimize. When optimization is enabled, the Concert compiler will report type errors. This can be a good way to debug you program.
The third level of optimization causes the resulting C++ code to be compiled with optimization (-O2). Very large CA functions can result in very large C++ functions which may require large amounts of memory. The code resulting from the third level of optimization is by far the fastest. The flag -L tells the compiler to assume that objects may be local even if it has no other reason to suspect they might be. This option will increase code size and may produce faster execution on very small numbers of processors.
In addition, the -g flag enables the compiler to include debugging information. The -I flag invokes the compiler interactively. Commands available in the interactive mode are explained in the next section.
The compiler can also be invoked within emacs. To compile a file from within Emacs, you must be in that file's buffer. Typing M-c will cause Emacs to display the default compile command concert which you can edit to add whatever flags you desire. Then press enter and Emacs will invoke the compiler on the buffer's file.
In interactive mode, the effect of changing the compile switches can be achieved through functions calls.
Programs can be compiled with the following calls:
There are a wide variety of compiler error messages that you may see when using the Concurrent Aggregates compiler. Since this compiler is an ongoing research project, there is no guarantee that it works perfectly all of the time. Hence, the error messages are divided up into two categories: those that are caused by the program being compiled and those that are internal to the compiler. Naturally, if you see any of the second kind, they should be reported. We briefly describe some common messages here, [5] contains a complete listing of all Concert error messages.
The following are error messages that indicate that something is wrong with the program being compiled.
These are errors that you should never see, for they indicate that something has gone wrong with the compiler. They should be reported to the Concurrent Systems Architecture Group. As the compiler is an ongoing research project, it is possible that an error in your program will confuse it, and it will produce an internal error. Hence, the best policy with all of these error messages is to first check your program for obvious errors, and, if you do not find any, report the problem to the Concert development team (send mail to concert-bugs@red-herring.cs.uiuc.edu).
In case of these errors (and other) you will get a message like:
Concert compiler internal error [possible error in user program as well] Check your code for an error and report the cause of this error to: concert-bugs@red-herring.cs.uiuc.edu
The executable program produced by the compiler has several builtin command line options. Executing the program with the -h option, for example, simply prints out a list of runtime options, as shown below for the fib program.
indigo-rilla > fib-example.ca.exec -h
usage prog [-n NUM_PROCS] [-t] [-p] [-a RANDOM/LOCAL] [-s RATE] [-m MEMORY]
-n NUM_PROCS set the number of processors
-t enable message tracing with debugging
-p enable performance profiling
-a RANDOM/LOCAL set aggregate send policy
-s RATE set events/sample rate
-m MEMORY set total memory usage of nodes (in MB)
The following command line options are admissible on both the CM5 and the uniprocessor simulator:
The additional command line options -t, -p, and -s are used for collecting statistics and debugging. They are described in sections 9 and 8.