Saturday, August 21, 2010

how to install AMD Open64 compiler on Ubuntu 10.04 x86_64

I will write here the steps I used to get this awesome compiler working on a fresh install of Ubuntu 10.04 LTS 64 bits.

I followed the steps in this link , with some minor changes:


This example worked for version 4.2.4
I used -j2 flag with make, you might need to remove it if you don't have two CPUs.

1. Get the files and install the necessary dependencies. We need:
- open64 4.2.4 source
- open64 4.2.3.4 binary

you can get these by typing in the terminal

wget http://download2-developer.amd.com/amd/open64/x86_open64-4.2.4-1.src.tar.bz2
wget http://download2-developer.amd.com/amd/open64/x86_open64-4.2.3.2-1.x86_64.tar.bz2


to install the dependencies:

sudo apt-get install build-essential gfortran flex bison
sudo apt-get install gcc-multilib g++-multilib gfortran-multilib lib32gcc1



2. Extract the source (4.2.4) to a temporary folder of your choice and compile with:

tar xjf x86_open64-4.2.4-1.src.tar.bz2
make -j2 all MACHINE_TYPE=i386 SHELL=/bin/bash

this took me around 30 min... when it's done run:

sudo ./install_compiler.sh i386
when asked for installation directory type:
/opt/x86_open64-4.2.4

don't worry if you see some errors about files not found


3. Extract 4.2.3.4 binary to /opt (or some other directory... you'll need to change commands to the right path if you do)

You should now have the directories
x86_open64-4.2.3.2/
x86_open64-4.2.4/
inside of /opt


4. Copy some files from version 4.2.3.2 (you may just copy/paste all the following lines)

sudo cp /opt/x86_open64-4.2.3.2/lib/gcc-lib/x86_64-open64-linux/4.2.3.2/libacml_mv.a /opt/x86_open64-4.2.4/lib/gcc-lib/x86_64-open64-linux/4.2.4/
sudo cp /opt/x86_open64-4.2.3.2/lib/gcc-lib/x86_64-open64-linux/4.2.3.2/libffio.a /opt/x86_open64-4.2.4/lib/gcc-lib/x86_64-open64-linux/4.2.4/
sudo cp /opt/x86_open64-4.2.3.2/lib/gcc-lib/x86_64-open64-linux/4.2.3.2/libffio.so /opt/x86_open64-4.2.4/lib/gcc-lib/x86_64-open64-linux/4.2.4/
sudo cp /opt/x86_open64-4.2.3.2/lib/gcc-lib/x86_64-open64-linux/4.2.3.2/libfortran.a /opt/x86_open64-4.2.4/lib/gcc-lib/x86_64-open64-linux/4.2.4/
sudo cp /opt/x86_open64-4.2.3.2/lib/gcc-lib/x86_64-open64-linux/4.2.3.2/libfortran.so /opt/x86_open64-4.2.4/lib/gcc-lib/x86_64-open64-linux/4.2.4/
sudo cp /opt/x86_open64-4.2.3.2/lib/gcc-lib/x86_64-open64-linux/4.2.3.2/libmv.a /opt/x86_open64-4.2.4/lib/gcc-lib/x86_64-open64-linux/4.2.4/
sudo cp /opt/x86_open64-4.2.3.2/lib/gcc-lib/x86_64-open64-linux/4.2.3.2/libmv.so.1 /opt/x86_open64-4.2.4/lib/gcc-lib/x86_64-open64-linux/4.2.4/
sudo cp /opt/x86_open64-4.2.3.2/lib/gcc-lib/x86_64-open64-linux/4.2.3.2/libopen64rt.a /opt/x86_open64-4.2.4/lib/gcc-lib/x86_64-open64-linux/4.2.4/
sudo cp /opt/x86_open64-4.2.3.2/lib/gcc-lib/x86_64-open64-linux/4.2.3.2/libopen64rt_shared.a /opt/x86_open64-4.2.4/lib/gcc-lib/x86_64-open64-linux/4.2.4/

sudo cp /opt/x86_open64-4.2.3.2/lib/gcc-lib/x86_64-open64-linux/4.2.3.2/32/libacml_mv.a /opt/x86_open64-4.2.4/lib/gcc-lib/x86_64-open64-linux/4.2.4/32
sudo cp /opt/x86_open64-4.2.3.2/lib/gcc-lib/x86_64-open64-linux/4.2.3.2/32/libffio.a /opt/x86_open64-4.2.4/lib/gcc-lib/x86_64-open64-linux/4.2.4/32
sudo cp /opt/x86_open64-4.2.3.2/lib/gcc-lib/x86_64-open64-linux/4.2.3.2/32/libffio.so /opt/x86_open64-4.2.4/lib/gcc-lib/x86_64-open64-linux/4.2.4/32
sudo cp /opt/x86_open64-4.2.3.2/lib/gcc-lib/x86_64-open64-linux/4.2.3.2/32/libfortran.a /opt/x86_open64-4.2.4/lib/gcc-lib/x86_64-open64-linux/4.2.4/32
sudo cp /opt/x86_open64-4.2.3.2/lib/gcc-lib/x86_64-open64-linux/4.2.3.2/32/libfortran.so /opt/x86_open64-4.2.4/lib/gcc-lib/x86_64-open64-linux/4.2.4/32
sudo cp /opt/x86_open64-4.2.3.2/lib/gcc-lib/x86_64-open64-linux/4.2.3.2/32/libmv.a /opt/x86_open64-4.2.4/lib/gcc-lib/x86_64-open64-linux/4.2.4/32
sudo cp /opt/x86_open64-4.2.3.2/lib/gcc-lib/x86_64-open64-linux/4.2.3.2/32/libmv.so.1 /opt/x86_open64-4.2.4/lib/gcc-lib/x86_64-open64-linux/4.2.4/32
sudo cp /opt/x86_open64-4.2.3.2/lib/gcc-lib/x86_64-open64-linux/4.2.3.2/32/libopen64rt.a /opt/x86_open64-4.2.4/lib/gcc-lib/x86_64-open64-linux/4.2.4/32
sudo cp /opt/x86_open64-4.2.3.2/lib/gcc-lib/x86_64-open64-linux/4.2.3.2/32/libopen64rt_shared.a /opt/x86_open64-4.2.4/lib/gcc-lib/x86_64-open64-linux/4.2.4/32



5. Compile the libraries

export PATH=$PATH:/opt/x86_open64-4.2.4/bin

make -j2 lib MACHINE_TYPE=i386 SHELL=/bin/bash BUILD_COMPILER=OSP
make -j2 -C osprey/targx8664_builtonia32 SHELL=/bin/bash BUILD_COMPILER=OS
P

and finally

sudo ./install_compiler.sh i386
when asked for installation directory type
/opt/x86_open64-4.2.4

It should be working by now. You can run an example to test the compiler here:
http://wiki.open64.net/index.php/Installation_on_Ubuntu

you can now remove the directory for the 4.2.3.2 version from /opt
sudo rm -rf /opt/x86_open64-4.2.3.2

don't forget to add /opt/x86_open64-4.2.4/bin to the PATH when using open64 (you can add this line to ~/.bashrc
export PATH=$PATH:/opt/x86_open64-4.2.4/bin