How do I select XL compiler versions?

You can determine the default XL compiler version by using the option -qversion=verbose. It is important to check the version number ("Level") of all components. Note they are in the form YYMMDD. For example:

You can choose a non-default version by modifying your ~/.soft file. Two lines are necessary: one to disable the default compilers, another to select the version you want. These must be in order preceding the @default.

For example:

@ibm-compilers-2014-08
@remove @ibm-compilers-default
#The @default must be the last entry in the file
@default

After modifying your ~/.soft, either use the command "resoft" or log out and back in again to refresh your environment. Confirm your selection by using the -qversion=verbose option as above. (The "resoft" command is a shell function or alias set up by /soft/environment/softenv-1.6.2/etc/softenv-aliases.sh or /soft/environment/softenv-1.6.2/etc/softenv-aliases.csh.) You will generally use the MPI wrappers for the compilers rather than invoke the compilers directly. You will need to choose which flavor of wrappers to use, such as +mpiwrapper-xl.legacy or +mpiwrapper-xl.legacy.ndebug (see "Blue Gene/Q Versus Blue Gene/P" and "Explanation of MPI Variants" for more details).

The -DBG is interpreted as two options. -D controls processing fixed-form source, and is mostly harmless. But -B is the option to override the path prefix for the XL component executables, and -BG means to use "G" as the path prefix. The same problem may manifest with a cpp error if the source is .F or .F90, which invokes cpp implicitly:

What is the default version of gcc cross-compiler?

How do I run time check for array accesses?

Run time checking of array accesses can be performed to verify that the index is in the defined range for the array. Array bound checking is enabled by setting the following compiler options with the XL compilers:

In addition to the array bound checking, enable the debugging information for both compilers with the "-g" option.

Programs compiled with array bound checking will check array indexes at run time to verify that they are within the array bounds. When an out of bound index is encountered, a SIGTRAP signal will be generated that terminates the program and causes core files to be written. The resulting core files may be examined to determine where in the program the out of bound reference occurred. To analyze a core file, use the bgq_stack command:

bgq_stack

(The bgq_stack command should be in your default path; if not, find it at /soft/debuggers/scripts/bin/bgq_stack.) Below is an example of an out of bound reference with the bad reference identified. The following program attempts to reference array indexes beyond the defined 100 entries in the array.

1 | #include <stdio.h>

2 | main( int argc, char**argv ){

3 | double a[100];

4 | printf("Start of Loop\n");

5 | for (int i = 0; i < 110; i++ ){

6 | a[i] = i;

7 | }

8 |

9 | printf("End of Loop\n");

10 | return 0;

11 | }

After compiling the code with array bound checking enabled: mpixlc -o boundschk -qcheck=bounds -g boundschk.c Executing the code produces the following output that shows the program exits due to a SIGTRAP signal (signal 5).

What do I do if compilation is slow?

The XL compilers will output additional diagnostic information when given the options -v and -qphsinfo. If -qphsinfo shows it spending a lot of time in IPA, a workaround is to compile the file(s) affected using -qnoipa (at the expense of optimization).

What are underscore mismatch problems during linking?

The default on BG/Q is to compile without appending any underscores to symbol names. (The -qnoextname option is default.) Because all the system libraries contain symbols without appended underscores, it is not recommended to override this setting. However, if you try to link with other code that was built with -qextname, which appends underscores, there will be a mismatch. The two options for dealing with the problem are to rebuild that library with -qnoextname or, if that is difficult, to explicitly override the underscore behavior just for particular symbols using -qextname=func_name.

For example:

Suppose the mylib.a is built using -qextname and contains a function mylib_initialize.

Compile using -qextname=mylib_initialize.

The -qextname option must be listed for every symbol used from the offending library; so unless the set of symbols is small, this method will not be practical.

My program does not compile or link. There are undefined symbols or definitions that seem to be from system libraries. What do I do?

Make sure you are not compiling or linking login-node include files and/or libraries from, for example, /usr/include or /usr/lib. These are for login node executables only, and are not intended for compute node cross compilation. If you are using the wrapper scripts (such as mpixlc), there is no need to reference compute-node libraries directly. However, for unusual situations you should know that they will be in /bgsys/drivers/ppcfloor. Non-system libraries for compute-node compilation are in /soft/libraries.

What is an R_PPC_REL24 error during linking?

Errors relating to R_PPC_REL24 during linking are due to the generated code being too large for 24-bit relative jumps to reach from some branch sites. When using the XL compilers, IBM's advice is to try one or more of these compiler options to mitigate the problem:

-qmaxmem=64000 [or some other large value]
-Wl,--relax
-qcompact

If these fail to solve the problem, contact support for further assistance.