source: pypar/install.py @ 85

Last change on this file since 85 was 85, checked in by ole, 19 years ago

Added pypar files

File size: 1.9 KB
Line 
1# =============================================================================
2# install.py - Installation of pypar (Parallel Python using MPI)
3# Copyright (C) 2001 Ole M. Nielsen
4#
5#    This program is free software; you can redistribute it and/or modify
6#    it under the terms of the GNU General Public License as published by
7#    the Free Software Foundation; either version 2 of the License, or
8#    (at your option) any later version.
9#
10#    This program is distributed in the hope that it will be useful,
11#    but WITHOUT ANY WARRANTY; without even the implied warranty of
12#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13#    GNU General Public License (http://www.gnu.org/copyleft/gpl.html)
14#    for more details.
15#
16#    You should have received a copy of the GNU General Public License
17#    along with this program; if not, write to the Free Software
18#    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
19#
20#
21# Contact address: Ole.Nielsen@anu.edu.au
22#
23# Version 1.0 October 2001
24# =============================================================================
25
26"""Module install.py - Compile C extension for pypar
27"""
28
29import os, sys     
30   
31
32# Attempt to compile mpiext.so
33#
34
35if sys.platform in ['osf1V5']:  #Compaq AlphaServer do not have mpicc (grr)
36  MPICC = 'cc -lmpi'
37else:
38  MPICC = 'mpicc' 
39
40try:
41  import compile
42  compile.compile('mpiext.c', MPICC, verbose = 1)
43except:
44  raise "Could not compile C extension mpiext.c - please try manually"       
45
46
47if sys.platform in ['osf1V5', 'sunos5']:  #Compaq AlphaServer or Sun
48  sys.exit()
49  # Alpha Server or Sun cannot import MPI on sequential processes
50  # OK with LAM
51
52#Check if MPI module can be initialised
53#
54# Attempt to import and initialise mpiext.so
55
56error = os.system('python -c "import mpiext" > /dev/null') 
57if error:
58  raise "MPI could not be initialised."
59else: 
60  import mpiext
61  print "MPI initialised OK"   
62
Note: See TracBrowser for help on using the repository browser.