Installation on Ubuntu

From Open64 Wiki

Jump to: navigation, search

Contents

Installation of Open64-4.1.0 on Ubuntu

Ubuntu

These instructions to install the Open64 compiler version 4.1 were tested on Ubuntu 7.10 (Gutsy) on AMD64.

Step 1: Install binary 4.1 from sf.net for fortran

To build the fortran compiler and libs, you need a working fortran compiler. The easiest solution is to download and install a precompiled open64 compiler package:

 wget http://downloads.sourceforge.net/open64/open64-4.1-0.x86_64.tar.bz2
 tar xjf open64-4.1-0.x86_64.tar.bz2
 cd open64-4.1
 sudo mkdir /opt/open64-4.1
 export TOOLROOT=/opt/open64-4.1
 export PATH=$TOOLROOT/bin:$PATH
 sudo ./INSTALL.sh
 cd ..

Step 2: Prepare source code

First, get the latest source code with the following command:

 svn export https://svn.open64.net/svnroot/open64/trunk open64
 cd open64

Then, in all Makefiles, change test -a into test -e in your favourite editor. You can find the Makefiles you need to change with the following command:

 grep -r 'test -a' *


In osprey/targx8664_builtonia32/libelf/Makefile change:

 OPTIMIZER = -O3 -fno-fast-stdlib

into:

 #OPTIMIZER = -O3 -fno-fast-stdlib
 OPTIMIZER = -O3

(as in osprey/targx8664_builtonia32/libdwarf/Makefile)

Step 3: Build compilers and libs

There are many scripts that use the default /bin/sh, but actually require bash. On Debian/Ubuntu, /bin/sh refers to dash, a simplified but posix-compliant shell, that won't work. Actually, all scripts should explicitly use bash if that is the only shell they work under, but there is an easier fix:

 make SHELL=/bin/bash all
 make SHELL=/bin/bash library

Step 4: Remove installed pre-compiled version

 rm -rf /opt/open64-4.1/*

Step 5: Install the compiled version

  sudo make SHELL=/bin/bash install

Step 6: Configure your environment

Put the following lines in your ~/.bashrc :

 export TOOLROOT=/opt/open64-4.1
 export PATH=$TOOLROOT/bin:$PATH

Step 7: Test

Save the following test program as testopenmp.c :

 #include <iostream>
 //#include <omp.h>
 int main()
 {
 //	std::cout << omp_get_max_threads() << std::endl;
 
       const int N = 1 << 12;
       const int M = 1 << 22;
 
       int *a = new int [N];
       #pragma omp parallel for
       for (int i = 0; i < N; ++i)
               a[i] = 0;
 
       #pragma omp parallel for
       for (int i = 0; i < N; ++i)
               for (int j = 0; j < M; ++j)
                       a[i] += j % N + 3;
 
       std::cout << a[7] <<  std::endl;
 
       return 0;
 }

Compile it like this:

 openCC -O3 -mp testopenmp.cc

Then run it:

 ./a.out

Verify that all your CPU's are active. If you decrease N and M a bit, you can compare against g++-4.2.

Personal tools