On 20 May 2010 02:25, Mag Gam <magaw...@gmail.com> wrote:
> Has anyone attempted to compile sage with ICC? This is the Intel
> compiler. I would like to do some testing with this therefore I would
> appreciate any tips.

I've not tried ICC, but I have tried SunStudio on Solaris (which is
also available on Linux). I hope the following is helpful.

One of the problems is that quite a number of bits in Sage do not
honor the variable 'CC' so setting the environment variable

CC=/path/to/SunStudio/bin/cc

does not result in 'cc' being used as the compiler, but 'gcc'. So if
the Intel compiler's name is 'icc' then some bits of Sage will build
with 'gcc' and not 'icc'. You might be able to avoid that by renaming
the compiler to 'gcc', but that is of course a horrible hack. Likewise
for the C++ and Fortran compilers. I've created tickets for a number
of the bits of Sage which ignore CC, but still some remain.

http://trac.sagemath.org/sage_trac/ticket/7071 (palp)
http://trac.sagemath.org/sage_trac/ticket/7069 (tachyon)
http://trac.sagemath.org/sage_trac/ticket/7066 (sympow)
http://trac.sagemath.org/sage_trac/ticket/7048 (ATLAS)
http://trac.sagemath.org/sage_trac/ticket/7040 (Sage library)


It would be great to rid Sage of that problem. I've done quite a bit
on that, probably fixing 10-20 packages so they respect the variables
CC, CXX, but there are still bits in Sage that ignore the setting of
CC, CXX and other common variables.

Some of the better components of Sage will build with Sun Studio,
though many will not - including the Sage library, as Cython is not
generating standard C. The Sun compiler is a lot more fussy about what
it will accept that 'gcc'.

I think you will hit the issue with CC and CXX not being respected.
The Fortran compiler in Sage is expected to be gfortran and so code
would need to be changed to make that work in a portable manner.

The parts of Sage that use 'SCons' (which includes c_lib in the Sage
library), might again have a problem if the C compiler is not called
'gcc'. SCons by design ignores the settings of PATH, CC, CXX and all
other environment variables. When SCons found SunStudio was installed,
it used the Sun C compiler and the GNU C++ compiler (or it might have
been the other way around). This took several months to resolve. The
ticket for that is

http://trac.sagemath.org/sage_trac/ticket/6595

which might mean further modifications would be necessary. That said,
SCons may detect the Intel compiler and use that. SCons tries to be
clever - too clever some times!

I believe 'icc' is supposed to have a GNU-like front end, so I assume
will accept all the GNU options, which Sun's compiler will not, so the
deficiencies in Sage should cause less problems with ICC than they do
with SunStudio.

I wrote two scripts

$SAGE_LOCAL/bin/testcxx.sh
$SAGE_LOCAL/bin/testcc.sh

which can detect if the compiler is from Sun, IBM, HP, GNU etc. It
does that by looking at what pre-processor directives are defined. For
example, the Sun C compiler defines __SUNPRO_CC but GCC does not. I
did similar for IBM's compiler on AIX, HP's on HP-UX.

I sort of gave up trying to fix the issues with CC being ignored
(hence a large number of open tickets by me), as I came to the
conclusion too many components of Sage are written in a non-portable
way that building with Sun Studio would be very difficult. I think
Intel's compiler will present you less problems.

It would be great if you can get ICC to work. Done properly, it should
also allow  the gccfss (GCC for Sun Systems) compiler to work. Like
ICC, that provides a gcc-like front end, but has generates faster code
than gcc.

One other problem you might hit, is trying to get ICC to generate
optimal code for your processor by using compiler flags specific to
ICC. Cython does not like CFLAGS set, so setting CFLAGS to add a
ICC-specific option will fail.

Unfortunately, two many bits of Sage were written with the GNU/Linux
mentality of "The operating system will be Linux, the C compiler will
be called 'gcc', the C++ compiler will be called 'g++' ..etc etc. I
find that very frustrating myself.

Dave

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to