This toolchain includes many features that can greatly improve the performance of your system, such as a scheduler that is optimized to take advantage of the PowerPC architecture, as well as support for hardware decimal floating point instructions which removes the overhead involved in decimal-to-binary conversions, leading to sizeable performance gains in programs that make heavy use of floating point arithmetic. It also includes support for VSX instruction set with the capability to perform auto-vectorization to increase the speed of your code as well as improve the energy efficiency of your machine.
To make things even better the entire Advance Toolchain is self-contained and requires only a few dependencies. The toolchain is also self-contained, installing in the /opt folder, so it will not conflict with the existing Linux toolchain.1.1 This Guide to Installation
This Guide to Installation is written specifically for Yellow Dog 7 and the IBM Advance Toolchain version 5.0.
Refer to us.fixstars.com/support for updates, issues specific with unique computer configurations, and engineering notes.2 Installation
There are two ways to install the Advance Toolchain on Yellow Dog Linux. The easiest is by doing an automated install using the YUM package manager, or you can install it manually using rpm. For both of these methods the first step is to get your hands on a copy of the gpg public key. This key can be used to verify the authenticity of the Advance Toolchain rpms and the contents of the repository to make sure that you are installing an official copy.
At the time of writing this Guide the key, as well as the toolchain itself, is being hosted by the University of Illinois at Urbana-Champaign. To download a copy navigate to the Advance Toolchain section of their linux patch website, located here:
and download a copy of the gpg-pubkey-00f50ac5-45e497dc to your computer. With the key downloaded you will now want to import that into your rpm database using the following command:
rpm –import gpg-pubkey-00f50ac5-45e497dc2.1 Using YUM
First, if you have never created an Advance Toolchain repository configuration file then you will need to do so now. What this will do is add a file that tells YUM where to look when you ask it to install packages for you. Of course, we want to add a file that tells YUM to look where the Advance Toolchain is located.
To do this you will to become root user and create a file:
and add the following content:
# Begin of configuration file
name=Advance Toolchain UIUC/NSCA FTP
# End of configuration file
To verify whether the configuration file was created successfully and is being recognized by YUM you can run the following command:
Which will output all of the locations that YUM looks for when installing packages. If everything has gone well then it should list Advance Toolchain UIUC/NSCA FTP.
To install execute yum install as root:
yum install advance-toolchain-at5.0-runtime
yum install advance-toolchain-at5.0-devel
yum install advance-toolchain-at5.0-parf
Answer y when YUM prompts for confirmation. Optionally, it is recommended to install the advance-toolchain-at5.0-mcore-libs package which contains the multi-core exploitation libraries which can improve performance when running on a multi-core machine.2.2 Manual Installation
To begin installing manually, download the rpms from the UIUC website.
Optionally, it is recommended to install the advance-toolchain-at5.0-mcore-libs package which contains the multi-core exploitation libraries which can improve performance when running on a multi-core machine.
When you have downloaded the package use rpm to install them in this order (due to dependencies):
rpm -i advance-toolchain-at5.0-runtime-5.0-1.ppc64.rpm
rpm -i advance-toolchain-at5.0-devel-5.0-1.ppc64.rpm
rpm -i advance-toolchain-at5.0-perf-5.0-1.ppc64.rpm
The rpm command should be run as root, failure to do so will result in an error. In case you installed the Advances Toolchain incorrectly, you might end up with an inconsistent rpm database (i.e rpm showing that the packages are installed, bu there are no files in /opt/at5.0). If this happens you will need to force-remove the rpms and install again. To force-remove all the Advance Toolchain rpms use the following command:
rpm -e –force advance-toolchain-*3 Usage
3.1 Manual Pages
In order for the man command to be able to pick up the Advance Toolchain manual pages you must export their location. This can be done with the following commands:
It can be convenient add this command to a profile file. All you need to do is create a file called advancetoolchain.sh in /etc/profile.d/ containing the following line:
export MANPATH=$MANPATH:/opt/at5.0/share/man3.2 Optimization Selection
Optimization selection is directing gcc to build an application for a particular architecture, taking advantage of specific features. This can be quite beneficial, and can result in significantly improved performance. Not setting the optimization will cause gcc to select the most general instruction set. For example, if you are using the 7r2 you want to set -mcpu=power7. It's important to note that for the power7 architecture if you disable Altivec (i.e. -mno-altivec) then you must always disable VSX (i.e. -mno-vsx). Not doing so will cause errors.3.3 Determining Platform and Hardware Capabilities
The Advance Toolchain include libauxv, a system library, and lsauxv, a Linux application, which provide a method for querying the system platform information. The system hardware capabilities (hwcap) can be queried with these tools as well. An example, the platform can be queried dynamically with the following function:
char * platform = (char *) query_auxv (AT_PLATFORM);
Information from the hwcap can be queried as well:
unsigned long int hwcap_mask = (unsigned long int) query_auxv (AT_HWCAP);
if (hwcap_mask & PPC_FEATURE_HAS_FPU)
For more information about using libauxv and lsauxv see the man pages that are included with the Advance Toolchain.3.4 Relinking a pre-build application with the Advance Toolchain
Locate all of the application's .o files. You can also link .a files to pick them all up at once. These will be needed for the relink.
Locate the paths to all of the necessary linked shared-object files, e.g.
/usr/X11R6/lib for libXrender
/opt/gnome/lib for libgtk-x11-2.0
Edit /opt/at5.0/etc/ld.so.conf and add the directories to all of the shared object files to the end of this file. Don't forget lib64 for the 64-bit equivalent libraries if applicable, e.g.
Run the Advance Toolchain's ldconfig application to regenerate /opt/at5.0/etc/ld.so.cache, e.g.
The loader uses /opt/at5.0/etc/ld.so.cache to find the libraries the application was linked against.
Relink using the Advance Toolchain's compiler:
/opt/at5.0/bin/gcc -g -O2 -o <application_name> <list_of_dot_o_files> \
<list_of_dot_a_files> -L<path_to_libraries> \
/opt/at5.0/bin/gcc -g -O2 -o mandelbrot callbacks.o interface.o \
main.o quadmand.o support.o mandel_internals.a \
-L/usr/X11R6/lib -L/usr/X11R6/lib64 -L/opt/gnome/lib -lgtk-x11-2.0
-lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 \
-lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -ldl \
-lglib-2.0 -lfreetype -lfontconfig \
-lXrender -lX11 -lXext -lpng12 -lz -lglitz -lm -lstdc++ -lpthread \
If ld gives an error like the following then you're missing the path to that library in the link stage. Add it with -L<path to library>, e.g.
/opt/at5.0/bin/ld: cannot find -lgtk-x11-2.0
Add -L/opt/gnome/lib/ to the gnome compilation line. You need to tell the linker where to find all of the libraries.
When running the relinked application, if you get an error like the following:
./mandelbrot: error while loading shared libraries: libglib-2.0.so.0: cannot open shared object file: No such file or directory.
You need to add the path to the library in question to /opt/at5.0/etc/ld.so.conf and re-run /opt/at5.0/sbin/ldconfig. The Advance Toolchain's loader needs to know where to find the libraries and uses the generated /opt/at5.0/etc/ld.so.cache to find them.
You can verify that the Advance Toolchain libraries were picked up by running the application prefaced with LD_DEBUG=libs, e.g.
WARNING: do NOT use LD_LIBRARY_PATH to point to the Advance Toolchain libraries if your applications are not relinked with the Advance Toolchain. Doing so can result in ld.so and libc.so version mismatch and cause runtime failures.3.5 Library Seach Paths
After the Advance Toolchain installation you may need to re-run /opt/at5.0/sbin/ldconfig in order to populate /opt/at5.0/etc/ld.so.cache with the additional search paths you have added to /etc/ld.so.conf. If you are running ldd against your binary and it is showing that some libraries can not be found then you need to re-run /opt/at5.0/sbin/ldconfig.4 Conclusion
This was just a brief overview of some of the core features of the IBM Advance Toolchain. To learn more about this tool there is an IBM Community Wiki as well as an IBM Community Forum with more in-depth coverage on the IBM Advance Toolchain on the POWER architecture.