Build Petsc DLL's with Visual Studio C++ 2003 compiler
Thuc Bui
bui at calcreek.com
Fri Oct 3 15:44:58 CDT 2008
Thanks a lot Chetan, for taking your time to provide insightful information.
I do build Petsc without Fortran. I will let you know how it goes. Thanks
again for your help.
Thuc
-----Original Message-----
From: owner-petsc-users at mcs.anl.gov [mailto:owner-petsc-users at mcs.anl.gov]
On Behalf Of Chetan Jhurani
Sent: Friday, October 03, 2008 10:43 AM
To: petsc-users at mcs.anl.gov
Subject: RE: Build Petsc DLL's with Visual Studio C++ 2003 compiler
> From: Thuc Bui
>
> Thank you Satish and Chetan very much for your answers. I will try out
> Chetan's project/solution files this weekend. Before doing so, I will need
> to re-run configure.py only once per Chetan's instruction then copy and
> rename the build directories. I will set the configuration option
> --with-shared=0. If this is incorrect, please let me know.
The options I had used are written below. Didn't know then that
with-dynamic=1
and with-shared=1 don't work on Windows. I was building under the
assumption of a
normal petsc build, and not for the purpose of using a visual studio project
later
on (hence the --download-f-blas-lapack).
Actually, I remember now why I made this into a separate project. My main
exe was
using multiple libraries (including petsc). Petsc used the C multithreaded
static
run time library. Some other one used C multithreaded dynamic run time
library.
I didn't want to play with the petsc build system on windows. It was
extremely
slow. I believe it took hours on my machine because process spawing is
slower. Or
perhaps the python interpreter was slow. So I just took the src tree and
created
a vcproj out of it and used the appropriate run-time library. Now it takes
just
4 minutes to build the full petsc tree (approx 725 object files).
I digress. But that was a justification, and some info if you need to know
which runtime lib is being used.
If you have problems about vcproj/sln files do let me know. I'm sure
this will be a bumpy ride and unlikely to be "official supported" either.
I forgot to mention the project contains just the C files. No fortran
file is compiled.
The configuration options --
--with-shared=1
--with-dynamic=1
--download-f-blas-lapack
-with-clanguage=C++
-with-debugging=yes --> Debug mode, could be changed.
--with-gnu-compilers=0
--with-cc=cl
--with-cxx=cl
--with-fc=ifort
--with-mpi=1
Chetan
> Thanks,
> Thuc
>
> -----Original Message-----
> From: owner-petsc-users at mcs.anl.gov
> [mailto:owner-petsc-users at mcs.anl.gov]
> On Behalf Of Chetan Jhurani
> Sent: Thursday, October 02, 2008 11:21 PM
> To: petsc-users at mcs.anl.gov
> Subject: RE: Build Petsc DLL's with Visual Studio C++ 2003 compiler
>
>
> On Thu, 2 Oct 2008, Satish Balay wrote:
> > On Thu, 2 Oct 2008, Thuc Bui wrote:
> >
> > > I attempt to build Petsc DLL libraries with configure.py
> using first
> with
> > > the option --with-shared=1, which is ignored as indicated in
> configure.log,
> > > and with --with-dynamic=1, which the script crashes.
> > >
> > > Is it possible to build Petsc DLL's? Does any one know
> how to do this? I
> > > would like to reduce the size of my executables since I
> have several
> using
> > > Petsc, and each of them is now huge comparing with that
> use the "old"
> > > Sparskit solver.
> >
> > Sorry - currently we don't have a mechanism to build dlls on
> > windows. So the above options [shared and dynamic] don't work on
> > windows.
>
>
> I have created a set of visual studio project/solution files.
> They've been
> tried with petsc-2.3.2-p7. There are 4 configurations --
> Debug, Release,
> DebugDLL, and ReleaseDLL. The first two create a static lib,
> and the last
> two create a DLL (one output file per config).
>
> This results in a petsc.dll of size 3 MB in release mode.
> Debug mode is 8.5
> MB.
>
> You can get them here - http://www.ices.utexas.edu/~chetan/petsc/
>
> Place the files in petsc-2.3.2-p7/src directory. Run petsc
> config script,
> rename the $config directories in bmake directory to appropriate name
> (Debug,
> Release, DebugDLL, ReleaseDLL). You'll have to run petsc
> configure ONCE and
> copy directories. Change PETSC_ARCH_NAME and PETSC_NAME in
> petscconf.h
> in each directory. Preprocessor macros like PETSC_DLL_EXPORT
> are defined
> in the vcproj file.
>
> Warnings:
>
> - I'm sure I've missed some steps that I no longer remember.
> - Not all the files in petsc/src are compiled. Most are.
> - The output (objs, libs, dlls) go into non-standard
> directories, so change
> them.
> - Some env variables, like $(MPI_DIR), are used in include/link paths.
> - blas.lib and lapack.lib are assumed to exist in link path.
>
> Chetan
>
>
>
More information about the petsc-users
mailing list