Docs: Installation: Win95/98/NT
We currently distribute PETSc libraries to work in
uniprocessor mode, under Windows NT/95/98 using Microsoft Visual C++ 6.0 compilers.See http://www.mcs.anl.gov/petsc/petsc-patches.html
and troubleshooting.html for help with problems.
Installing PETSc:
- Run petsc.exe and one or either
of petsc-c.exe, petsc-c++.exe or petsc-complex.exe,and they
will create a directory
c:\petsc-2.0.29
containing all the source code, documentation and (C and or C++) libraries.
- Add
set PETSC_DIR=c:\petsc-2.0.29
set PETSC_ARCH=win32
to your autoexec.bat (for Windows 95) or
Settings->Control Panel->System->Environment Tab->User
Variables (for Windows NT)
Settings->Control Panel->System->Advanced->
Environment Variables ->User
Variables (for Windows 2000)
Note: In Windows NT/2000, when a new command window is opened, the
updated environment variables should be available in the new window.
Running Examples from a Shell:
- Verify that nmake and cl (the
Microsoft make utility and compiler) run from the command line; if they do
not, then
set them up.
- Change to an example directory: cd
c:\petsc-2.0.29\src\is\examples\tutorials
- Compile an example program: nmake BOPT=g ex1 (note it is nmake
not make)
- Run this example program: ex1
- Try other examples in the directories src\*\examples\tutorials and
src\*\*\examples\tests
Running Examples from Microsoft Visual Studio: (using a Project)
Two project files, one for C libraries, and the other for the C++ libraries, are
provided with the PETSc distribution.They are located in
c:\petsc-2.0.29\projects\[c,c++]\sles\ex2 directory. To build and run the example file
using the project provided:
- Make sure that the environment variables PETSC_ARCH and PETSC_DIR are set correctly and are accessable to the Visual
Studio.
- Load the project file ex2.dsw into Microsoft Visual Studio.
- To compile the example, use Menu ->Build -> Build ex2.exe (F7)
- To run the example, use Menu -> Build -> Execute ex2.exe (Ctrl-F5)
To create a project for your files:
- From c:\petsc-2.0.29\projects\[c,c++]\sles\ex2 Copy the files - ex2.dsw
and ex2.dsp, to the location of your project directory.
- Rename the files to your desires project name - say - my_prj.dsw
and my_prj.dsp
- Load the new project file my_prj.dsw into Microsoft Visual
Studio.
- From file view stub, remove the source file ex2.[c,cpp]
- From Menu Project -> add to project -> files, add the user source files to the
project.
Program Arguments: can be set in Developer Studio from the Menu
Project -> settings ->Debug -> program arguments.
Currently we only provide project examples using console applications;
developing a windows application requires creating a new project. Also the
project files are used with PETSC_ARCH=win32 only - which uses MPIUNI. For
other PETSC_ARCHEs, the appropriate project files have to be created.
Fortran Users:
If you have the Digitial Visual Fortran compiler (with the latest patches), you can
compile PETSc Fortran code
- Verify that nmake and df (the Microsoft make utility and
fortran compiler ) run from the command line; if they do not, then set them
up.
- Change to an example directory: cd
c:\petsc-2.0.29\src\is\examples\tutorials
- Compile an example program: nmake BOPT=g ex1f
- Run this example program: ex1f
Running Fortran examples from Developer Studio:
Currently this is not possible, as we need to use the build targes provided in the
PETSc base files.
Rebuilding
Libraries
The Windows version of PETSc comes with the C and C++ version libraries pre-built. If,
for some reason you need to rebuild the libraries, you can do the following:
- Verify that nmake and cl (the Microsoft make utility
and compiler ) run from the command line; if they do not, then set them
up.
- If you made changes in single directories, then run
nmake BOPT=g or
nmake BOPT=O from those directories
- To rebuild all the libraries (debugging version), from the main
PETSc directory run
nmake BOPT=g all from the main PETSc directory (or use the O option).
Using
Microsoft Visual C/C++ Compiler from the Command Line:
If the commands nmake and vc do not work from the DOS command line, but you do have
Microsoft Developer Studio installed, you can either
- register the env-variables when installing the compiler suite or
- run the script Program
Files\Microsoft Visual Studio\VC98\bin\vcvars32.bat or
- create a modified command-prompt/(shortcut) with a 'target' C:\WINNT\System32\cmd.exe /K "C:\Program Files\Microsoft Visual
Studio\VC98\BIN\VCVARS.BAT"
Complex version of PETSc libraries
To use the complex version of PETSc libraries, you need Digital Visual Fortran compiler
along with Microsoft's Visual C++ compiler. Before you can compile the C example files,
edit the file bmake/win32/base and chnage the varaible CXX_CLINKER to use the fortran
compiler instead of the C++ compiler.
Using MPI on Windows NT/95/98
The default PETSc libraries, that come with the distibution work in uniprocessor mode
only. You can use PETSc with either of the following implementations of MPI
- WMPI - an
implementation of MPI form Coimbra University, Portugal. This implementation of MPI works
on Windows NT as well as Windows 95/98. To make sure that WMPI works from
both C and fortran PETSc examples, download the version of WMPI compiled
for PETSc
- HPVM - an
implementation of MPI from University of Illinois at Urbana-Champaign and University of
California, San Diego. This implementation of MPI works on Windows NT only.
- MPICH.NT - an
implementation of MPI from ANL.
To install PETSc with MPI, you would have to do the following:
- Edit the file bmake/win32/base.site and change the variables MPI_INCLUDE
and MPI_LIB to point to the installation location of MPI.
- Edit the file bmake/win32/base and make sure that the compile flags specified in COPTFLAGS
and FOPTFLAGS match the compile flags used to build MPI.
- Now rebuild the PETSc libraries.
Installing PETSc Using gcc/g77:
PETSc can be installed on Windows NT/95 using gnu-win32 tools from Cygnus Solutions, (which contains bash and make) and EGCS version of gcc, g++, g77
compilers. Currently we use gnu-win32 version beta-20 and gcc 2.95.2 compilers for
cygwin beta 20.1.
- Get the unix distribution of petsc. i.e, petsc-2.0.29.tar.gz.
- To build blas, lapack,
use g77.
- To build PETSc, use the following:
bash (use the
bash shell which is part of gnu-win32)
export PETSC_ARCH=win32_gnu
export PETSC_DIR=/petsc-2.0.29
- To build the libraries (debugging version), run
make BOPT=g all