Commits

Jed Brown  committed 25a7538 Merge with conflicts

Merge branch 'jed/remove-dynamic-loading-option'

Option --with-dynamic-loading has been removed. Similar functionality
is available via the run-time option -dynamic_library_preload.

* jed/remove-dynamic-loading-option:
Sys: PetscContainerCreate must call PetscSysInitializePackage
Remove --with-dynamic-loading / PETSC_USE_DYNAMIC_LIBRARIES

Conflicts:
src/dm/impls/mesh/mesh.c
src/dm/interface/dlregisdmdm.c
src/docs/website/documentation/changes/dev.html

  • Participants
  • Parent commits c409a35, d2bbedb

Comments (0)

Files changed (76)

File bin/TOPSInstaller.py

 
 
         args.append('--with-shared-libraries=1')
-        args.append('--with-dynamic-loading=1')
         args.append('--with-external-packages-dir='+reply)
         args = multenterbox("Configure options you have selected.", title, None, args)
         if not args: sys.exit()

File bin/maint/asterix-test.sh

 # basic sun tests
 ./config/examples/asterix/asterix64-sun.py
 make PETSC_ARCH=asterix64-sun all test
-./config/examples/asterix/asterix64-sun.py --with-shared-libraries=1 --with-dynamic-loading=1 -PETSC_ARCH=asterix64-sun-dynamic
+./config/examples/asterix/asterix64-sun.py --with-shared-libraries=1 -PETSC_ARCH=asterix64-sun-dynamic
 make PETSC_ARCH=asterix64-sun-dynamic all alltests tests_DATAFILESPATH DATAFILESPATH=/home/balay/datafiles
 ./config/examples/asterix/asterix64-sun.py --with-clanguage=cxx -PETSC_ARCH=asterix64-sun-cxx  --with-debugging=0 --with-pic=0 \
 --download-f-blaslapack=1 --download-spooles=1 --download-superlu=1 \
 make PETSC_ARCH=asterix64-sun-cxx all
 make PETSC_ARCH=asterix64-sun-cxx CLINKER=sun-cc shared
 make PETSC_ARCH=asterix64-sun-cxx test
-./config/examples/asterix/asterix64-sun.py --with-shared-libraries=1 --with-dynamic-loading=1 --with-scalar-type=complex --with-clanguage=cxx -PETSC_ARCH=asterix64-sun-complex-dynamic
+./config/examples/asterix/asterix64-sun.py --with-shared-libraries=1 --with-scalar-type=complex --with-clanguage=cxx -PETSC_ARCH=asterix64-sun-complex-dynamic
 make PETSC_ARCH=asterix64-sun-complex-dynamic all
 make PETSC_ARCH=asterix64-sun-complex-dynamic CLINKER=sun-cc shared
 make PETSC_ARCH=asterix64-sun-complex-dynamic test

File bin/maint/package-test.sh

 set -x
 ECHO=
 
-OPT1='--with-shared-libraries=1 --with-dynamic-loading=1 --with-debugging=0'
+OPT1='--with-shared-libraries=1 --with-debugging=0'
 OPT2='--with-clanguage=cxx --with-sieve=1 --with-log=0'
 OPT3='--with-scalar-type=complex --with-clanguage=cxx --with-pic=0 --with-log=0'
 

File config/BuildSystem/config/setCompilers.py

        - There needs to be a test that checks that the functionality is actually working'''
     self.usePIC = 0
     useSharedLibraries = 'with-shared-libraries' in self.framework.argDB and self.framework.argDB['with-shared-libraries']
-    useDynamicLoading  = 'with-dynamic-loading'  in self.framework.argDB and self.framework.argDB['with-dynamic-loading']
-    if not self.framework.argDB['with-pic'] and not useSharedLibraries and not useDynamicLoading:
+    if not self.framework.argDB['with-pic'] and not useSharedLibraries:
       self.framework.logPrint("Skip checking PIC options on user request")
       return
     languages = ['C']
 
   def generateSharedLinkerGuesses(self):
     useSharedLibraries = 'with-shared-libraries' in self.framework.argDB and self.framework.argDB['with-shared-libraries']
-    useDynamicLoading  = 'with-dynamic-loading'  in self.framework.argDB and self.framework.argDB['with-dynamic-loading']
-    if not self.framework.argDB['with-pic'] and not useSharedLibraries and not useDynamicLoading:
+    if not self.framework.argDB['with-pic'] and not useSharedLibraries:
       self.setStaticLinker()
       self.staticLinker = self.AR
       self.staticLibraries = 1

File config/PETSc/utilities/sharedLibraries.py

     self.headerPrefix = ''
     self.substPrefix  = ''
     self.useShared    = 0
-    self.useDynamic   = 0
     return
 
   def __str1__(self):
-    if not hasattr(self, 'useShared') or not hasattr(self, 'useDynamic'):
+    if not hasattr(self, 'useShared'):
       return ''
     txt = ''
     if self.useShared:
       txt += '  shared libraries: enabled\n'
     else:
       txt += '  shared libraries: disabled\n'
-    if self.useDynamic:
-      txt += '  dynamic loading: enabled\n'
-    else:
-      txt += '  dynamic loading: disabled\n'
     return txt
 
   def setupHelp(self, help):
     import nargs
     help.addArgument('PETSc', '-with-shared-libraries=<bool>', nargs.ArgBool(None, 1, 'Make PETSc libraries shared -- libpetsc.so (Unix/Linux) or libpetsc.dylib (Mac)'))
-    help.addArgument('PETSc', '-with-dynamic-loading=<bool>', nargs.ArgBool(None, 0, 'Make PETSc libraries dynamic -- uses dlopen() to access libraries, rarely needed'))
     return
 
   def setupDependencies(self, framework):
     # uf user specified 'with-shared' or 'with-dynamic' - flag an error
     if 'with-shared' in self.framework.argDB:
       raise RuntimeError('Option "--with-shared" no longer exists. Use "--with-shared-libraries".')
-    if 'with-dynamic' in self.framework.argDB:
-      raise RuntimeError('Option "--with-dynamic" no longer exists. Use "--with-dynamic-loading".')
+    if 'with-dynamic' in self.framework.argDB or 'with-dynamic-loading' in self.framework.argDB:
+      raise RuntimeError('Option "--with-dynamic" and "--with-dynamic-loading" no longer exist.')
     # if user specifies inconsistant 'with-dynamic-loading with-shared-libraries with-pic' options - flag error
-    if self.framework.argDB['with-dynamic-loading'] and not self.framework.argDB['with-shared-libraries'] and 'with-shared-libraries' in self.framework.clArgDB:
-      raise RuntimeError('If you use --with-dynamic-loading you cannot disable --with-shared-libraries')
-    if self.framework.argDB['with-dynamic-loading'] and not self.framework.argDB['with-pic'] and 'with-pic' in self.framework.clArgDB:
-      raise RuntimeError('If you use --with-dynamic-loading you cannot disable --with-pic')
     if self.framework.argDB['with-shared-libraries'] and not self.framework.argDB['with-pic'] and 'with-pic' in self.framework.clArgDB:
       raise RuntimeError('If you use --with-shared-libraries you cannot disable --with-pic')
 
-    # default with-dynamic-loading=1 => with-shared-libraries=1 --with-pic=1
     # default with-shared-libraries=1 => --with-pic=1
     # Note: there is code in setCompilers.py that uses this as default.
-    if self.framework.argDB['with-dynamic-loading'] and not self.framework.argDB['with-shared-libraries']: self.framework.argDB['with-shared-libraries'] = 1
     if self.framework.argDB['with-shared-libraries'] and not self.framework.argDB['with-pic']: self.framework.argDB['with-pic'] = 1
     return
 
     return
 
   def configureDynamicLibraries(self):
-    '''Checks whether dynamic loading should be used, for which you must
-      - Specify --with-dynamic-loading
-      - Have found a working dynamic linker (with dlfcn.h and libdl)
-    Defines PETSC_USE_DYNAMIC_LIBRARIES if they are used'''
+    '''Checks whether dynamic loading is available (with dlfcn.h and libdl)'''
     if self.setCompilers.dynamicLibraries:
       self.addDefine('HAVE_DYNAMIC_LIBRARIES', 1)
-    self.useDynamic = self.framework.argDB['with-dynamic-loading'] and self.useShared and self.setCompilers.dynamicLibraries
-    if self.useDynamic:
-      self.addDefine('USE_DYNAMIC_LIBRARIES', 1)
-    else:
-      self.logPrint('Dynamic loading - disabled')
     return
 
   def configure(self):

File config/examples/arch-c-exodus-dbg-builder.py

     '--download-triangle',
     '--with-cuda',
     '--with-cuda-only',
-    '--with-dynamic-loading',
     '--with-shared-libraries',
   ]
   configure.petsc_configure(configure_options)

File config/examples/arch-linux-gcc-real-opt.py

     '--download-mpich=1',
     '--with-cc=gcc',
     '--with-clanguage=c',
-    '--with-dynamic-loading=1',
     '--with-shared-libraries=1',
     '--with-python=1',
     '--with-debugging=0',

File config/examples/arch-linux-gcc-real.py

     '--download-mpich=1',
     '--with-cc=gcc',
     '--with-clanguage=c',
-    '--with-dynamic-loading=1',
     '--with-shared-libraries=1',
     '--with-python=1',
     '--PETSC_ARCH=arch-linux-gcc-real'

File config/examples/arch-linux-gxx-complex.py

     '--with-cxx=g++',
     '--with-clanguage=C++',
     '--with-scalar-type=complex',
-    '--with-dynamic-loading=1',
     '--with-shared-libraries=1',
     '--with-python=1',
     '--PETSC_ARCH=arch-linux-gxx-complex'

File config/examples/basic/arch-gcc-complex-O.py

     '--with-cc=gcc',
     '--with-clanguage=c',
     '--with-scalar-type=complex',
-    '--with-dynamic-loading=1',
     '--with-shared-libraries=1',
     '--download-f-blas-lapack=1',
     '--download-mpich=1',

File config/examples/basic/arch-gcc-complex.py

     '--with-cc=gcc',
     '--with-clanguage=c',
     '--with-scalar-type=complex',
-    '--with-dynamic-loading=1',
     '--with-shared-libraries=1',
     '--download-f-blas-lapack=1',
     '--download-mpich=1',

File config/examples/basic/arch-gcc-real-O.py

     '--download-mpich=1',
     '--with-cc=gcc',
     '--with-clanguage=c',
-    '--with-dynamic-loading=1',
     '--with-shared-libraries=1',
     '--with-python=1',
     '--with-debugging=0',

File config/examples/basic/arch-gcc-real.py

     '--download-mpich=1',
     '--with-cc=gcc',
     '--with-clanguage=c',
-    '--with-dynamic-loading=1',
     '--with-shared-libraries=1',
     '--with-python=1',
     '--PETSC_ARCH=arch-gcc-real'

File config/examples/basic/arch-gcc64-complex-O.py

     '--with-clanguage=c',
     '--with-64-bit-indices=1',
     '--with-scalar-type=complex',
-    '--with-dynamic-loading=1',
     '--with-shared-libraries=1',
     '--download-f-blas-lapack=1',
     '--download-mpich=1',

File config/examples/basic/arch-gcc64-complex.py

     '--with-clanguage=c',
     '--with-64-bit-indices=1',
     '--with-scalar-type=complex',
-    '--with-dynamic-loading=1',
     '--with-shared-libraries=1',
     '--download-f-blas-lapack=1',
     '--download-mpich=1',

File config/examples/basic/arch-gcc64-real-O.py

     '--with-clanguage=c',
     '--with-64-bit-indices=1',
     '--with-scalar-type=real',
-    '--with-dynamic-loading=1',
     '--with-shared-libraries=1',
     '--download-f-blas-lapack=1',
     '--download-mpich=1',

File config/examples/basic/arch-gcc64-real.py

     '--with-clanguage=c',
     '--with-64-bit-indices=1',
     '--with-scalar-type=real',
-    '--with-dynamic-loading=1',
     '--with-shared-libraries=1',
     '--download-f-blas-lapack=1',
     '--download-mpich=1',

File config/examples/basic/arch-gxx-complex-O.py

     '--with-cxx=g++',
     '--with-clanguage=C++',
     '--with-scalar-type=complex',
-    '--with-dynamic-loading=1',
     '--with-shared-libraries=1',
     '--with-python=1',
     '--with-debugging=0',

File config/examples/basic/arch-gxx-complex.py

     '--with-cxx=g++',
     '--with-clanguage=C++',
     '--with-scalar-type=complex',
-    '--with-dynamic-loading=1',
     '--with-shared-libraries=1',
     '--with-python=1',
     '--PETSC_ARCH=arch-gxx-complex'

File config/examples/basic/arch-gxx-real-O.py

     '--with-cxx=g++',
     '--with-clanguage=C++',
     '--with-scalar-type=real',
-    '--with-dynamic-loading=1',
     '--with-shared-libraries=1',
     '--with-python=1',
     '--with-debugging=0',

File config/examples/basic/arch-gxx-real.py

     '--with-cxx=g++',
     '--with-clanguage=C++',
     '--with-scalar-type=real',
-    '--with-dynamic-loading=1',
     '--with-shared-libraries=1',
     '--with-python=1',
     '--PETSC_ARCH=arch-gxx-real'

File config/examples/basic/arch-gxx64-complex-O.py

     '--with-clanguage=C++',
     '--with-64-bit-indices=1',
     '--with-scalar-type=complex',
-    '--with-dynamic-loading=1',
     '--with-shared-libraries=1',
     '--download-f-blas-lapack=1',
     '--download-mpich=1',

File config/examples/basic/arch-gxx64-complex.py

     '--with-clanguage=C++',
     '--with-64-bit-indices=1',
     '--with-scalar-type=complex',
-    '--with-dynamic-loading=1',
     '--with-shared-libraries=1',
     '--download-f-blas-lapack=1',
     '--download-mpich=1',

File config/examples/basic/arch-gxx64-real-O.py

     '--with-clanguage=C++',
     '--with-64-bit-indices=1',
     '--with-scalar-type=real',
-    '--with-dynamic-loading=1',
     '--with-shared-libraries=1',
     '--download-f-blas-lapack=1',
     '--download-mpich=1',

File config/examples/basic/arch-gxx64-real.py

     '--with-clanguage=C++',
     '--with-64-bit-indices=1',
     '--with-scalar-type=real',
-    '--with-dynamic-loading=1',
     '--with-shared-libraries=1',
     '--download-f-blas-lapack=1',
     '--download-mpich=1',

File include/petscsys.h

 
    Level: advanced
 
-   --with-shared-libraries --with-dynamic-loading must be used with ./configure to use dynamic libraries
-
 .seealso:  PetscDLLibraryOpen()
 S*/
 typedef struct _n_PetscDLLibrary *PetscDLLibrary;

File src/dm/dt/interface/dtfe.c

   PetscFunctionBegin;
   PetscValidPointer(sp, 2);
   *sp = NULL;
-#if !defined(PETSC_USE_DYNAMIC_LIBRARIES)
   ierr = PetscFEInitializePackage();CHKERRQ(ierr);
-#endif
 
   ierr = PetscHeaderCreate(s, _p_PetscSpace, struct _PetscSpaceOps, PETSCSPACE_CLASSID, "PetscSpace", "Linear Space", "PetscSpace", comm, PetscSpaceDestroy, PetscSpaceView);CHKERRQ(ierr);
   ierr = PetscMemzero(s->ops, sizeof(struct _PetscSpaceOps));CHKERRQ(ierr);
   PetscFunctionBegin;
   PetscValidPointer(sp, 2);
   *sp = NULL;
-#if !defined(PETSC_USE_DYNAMIC_LIBRARIES)
   ierr = PetscFEInitializePackage();CHKERRQ(ierr);
-#endif
 
   ierr = PetscHeaderCreate(s, _p_PetscDualSpace, struct _PetscDualSpaceOps, PETSCDUALSPACE_CLASSID, "PetscDualSpace", "Dual Space", "PetscDualSpace", comm, PetscDualSpaceDestroy, PetscDualSpaceView);CHKERRQ(ierr);
   ierr = PetscMemzero(s->ops, sizeof(struct _PetscDualSpaceOps));CHKERRQ(ierr);
   PetscFunctionBegin;
   PetscValidPointer(fem, 2);
   *fem = NULL;
-#if !defined(PETSC_USE_DYNAMIC_LIBRARIES)
   ierr = PetscFEInitializePackage();CHKERRQ(ierr);
-#endif
 
   ierr = PetscHeaderCreate(f, _p_PetscFE, struct _PetscFEOps, PETSCFE_CLASSID, "PetscFE", "Finite Element", "PetscFE", comm, PetscFEDestroy, PetscFEView);CHKERRQ(ierr);
   ierr = PetscMemzero(f->ops, sizeof(struct _PetscFEOps));CHKERRQ(ierr);

File src/dm/impls/da/fdda.c

   DM_DA          *dd = (DM_DA*)da->data;
 
   PetscFunctionBegin;
-#if !defined(PETSC_USE_DYNAMIC_LIBRARIES)
   ierr = MatInitializePackage();CHKERRQ(ierr);
-#endif
   if (!mtype) mtype = MATAIJ;
   ierr = PetscStrcpy((char*)ttype,mtype);CHKERRQ(ierr);
   ierr = PetscOptionsBegin(PetscObjectComm((PetscObject)da),((PetscObject)da)->prefix,"DMDA options","Mat");CHKERRQ(ierr);

File src/dm/impls/plex/plex.c

   PetscErrorCode ierr;
 
   PetscFunctionBegin;
-#if !defined(PETSC_USE_DYNAMIC_LIBRARIES)
   ierr = MatInitializePackage();CHKERRQ(ierr);
-#endif
   if (!mtype) mtype = MATAIJ;
   ierr = DMGetDefaultSection(dm, &section);CHKERRQ(ierr);
   ierr = DMGetDefaultGlobalSection(dm, &sectionGlobal);CHKERRQ(ierr);

File src/dm/interface/dlregisdmdm.c

   PetscFunctionReturn(0);
 }
 
-#if defined(PETSC_USE_DYNAMIC_LIBRARIES)
+#if defined(PETSC_HAVE_DYNAMIC_LIBRARIES)
 #undef __FUNCT__
 #define __FUNCT__ "PetscDLLibraryRegister_petscdm"
 /*
   PetscFunctionReturn(0);
 }
 
-#endif /* PETSC_USE_DYNAMIC_LIBRARIES */
+#endif /* PETSC_HAVE_DYNAMIC_LIBRARIES */

File src/dm/interface/dm.c

   PetscFunctionBegin;
   PetscValidPointer(dm,2);
   *dm = NULL;
-#if !defined(PETSC_USE_DYNAMIC_LIBRARIES)
   ierr = VecInitializePackage();CHKERRQ(ierr);
   ierr = MatInitializePackage();CHKERRQ(ierr);
   ierr = DMInitializePackage();CHKERRQ(ierr);
-#endif
 
   ierr = PetscHeaderCreate(v, _p_DM, struct _DMOps, DM_CLASSID, "DM", "Distribution Manager", "DM", comm, DMDestroy, DMView);CHKERRQ(ierr);
   ierr = PetscMemzero(v->ops, sizeof(struct _DMOps));CHKERRQ(ierr);
 
   PetscFunctionBegin;
   PetscValidHeaderSpecific(dm,DM_CLASSID,1);
-#if !defined(PETSC_USE_DYNAMIC_LIBRARIES)
   ierr = MatInitializePackage();CHKERRQ(ierr);
-#endif
   PetscValidHeaderSpecific(dm,DM_CLASSID,1);
   PetscValidPointer(mat,3);
   if (dm->mattype) {

File src/docs/website/documentation/changes/dev.html

       <ul>
         <li>PetscObjectStateQuery() is now corrected with PetscObjectStateGet()</li>
         <li>A new PetscObjectState typedef is used by interface; 64-bit int to prevent overflow.</li>
+        <li>
+          The configure option <tt>--with-dynamic-loading</tt> has been
+          removed since this functionality is automatically available on
+          systems that support it.  Use the runtime
+          option <tt>-dynamic_library_preload</tt> for similar functionality.
+        </li>
       </ul>
       <h4>IS:</h4>
       <h4>PF:</h4>

File src/docs/website/documentation/faq.html

         <li><a href="#link-shared">How do I link to the PETSc shared libraries?</a></li>
         <li><a href="#link-regular-lib">What if I want to link to the regular .a library files?</a></li>
         <li><a href="#move-shared-exec">What do I do if I want to move my executable to a different machine?</a></li>
-        <li><a href="#dynamic-shared">What is the deal with dynamic libraries (and difference with shared libraries)?</a></li>
       </ul>
 
     </div>
 
       <h3><a name="dylib">Unable to locate PETSc dynamic library /home/balay/spetsc/lib/libg/linux/libpetsc</a></h3>
 
-      When using DYNAMIC libraries - the libraries cannot be moved after they are
-      installed. This could also happen on clusters - where the paths are
-      different on the (run) nodes - than on the (compile) front-end. Do not use
-      dynamic libraries &amp; shared libraries. Run ./configure with
-      <code>--with-shared-libraries=0 --with-dynamic-loading=0</code>
+      <p>
+        When using DYNAMIC libraries - the libraries cannot be moved after they are
+        installed. This could also happen on clusters - where the paths are
+        different on the (run) nodes - than on the (compile) front-end. Do not use
+        dynamic libraries &amp; shared libraries. Run ./configure with
+        <code>--with-shared-libraries=0 --with-dynamic-loading=0</code>.
+        This option has been removed in petsc-3.5.
+      </p>
 
       <h3><a name="bisect">How do I determine what update to PETSc broke my code?</a></h3>
 
         executable.
       </p>
 
-      <h3><a name="dynamic-shared">What is the deal with dynamic libraries (and difference between shared libraries)?</a></h3>
-
-      <p>
-        PETSc libraries are installed as dynamic libraries when the ./configure
-        flag --with-dynamic-loading is used. The difference with this - from
-        shared libraries - is the way the libraries are used. From the program
-        the library is loaded using dlopen() - and the functions are searched
-        using dlsymm(). This separates the resolution of function names from
-        link-time to run-time - i.e when dlopen()/dlsymm() are called.
-      </p>
-
-      <p>
-        When using Dynamic libraries - PETSc libraries cannot be moved to
-        a different location after they are built.
-      </p>
-
     </div>
 
     <!--end-->

File src/ksp/ksp/interface/dlregisksp.c

   PetscFunctionReturn(0);
 }
 
-#if defined(PETSC_USE_DYNAMIC_LIBRARIES)
+#if defined(PETSC_HAVE_DYNAMIC_LIBRARIES)
 
 #undef __FUNCT__
 #define __FUNCT__ "PetscDLLibraryRegister_petscksp"
   PetscFunctionReturn(0);
 }
 
-#endif /* PETSC_USE_DYNAMIC_LIBRARIES */
+#endif /* PETSC_HAVE_DYNAMIC_LIBRARIES */

File src/ksp/ksp/interface/dmksp.c

   PetscErrorCode ierr;
 
   PetscFunctionBegin;
-#if !defined(PETSC_USE_DYNAMIC_LIBRARIES)
   ierr = KSPInitializePackage();CHKERRQ(ierr);
-#endif
   ierr = PetscHeaderCreate(*kdm, _p_DMKSP, struct _DMKSPOps, DMKSP_CLASSID, "DMKSP", "DMKSP", "DMKSP", comm, DMKSPDestroy, NULL);CHKERRQ(ierr);
   ierr = PetscMemzero((*kdm)->ops, sizeof(struct _DMKSPOps));CHKERRQ(ierr);
   PetscFunctionReturn(0);

File src/ksp/ksp/interface/itcreate.c

   PetscFunctionBegin;
   PetscValidPointer(inksp,2);
   *inksp = 0;
-#if !defined(PETSC_USE_DYNAMIC_LIBRARIES)
   ierr = KSPInitializePackage();CHKERRQ(ierr);
-#endif
 
   ierr = PetscHeaderCreate(ksp,_p_KSP,struct _KSPOps,KSP_CLASSID,"KSP","Krylov Method","KSP",comm,KSPDestroy,KSPView);CHKERRQ(ierr);
 

File src/ksp/ksp/utils/schurm.c

   PetscErrorCode ierr;
 
   PetscFunctionBegin;
-#if !defined(PETSC_USE_DYNAMIC_LIBRARIES)
   ierr = KSPInitializePackage();CHKERRQ(ierr);
-#endif
   ierr = MatCreate(((PetscObject)A00)->comm,N);CHKERRQ(ierr);
   ierr = MatSetType(*N,MATSCHURCOMPLEMENT);CHKERRQ(ierr);
   ierr = MatSchurComplementSet(*N,A00,Ap00,A01,A10,A11);CHKERRQ(ierr);

File src/ksp/pc/impls/gamg/gamg.c

   pc_gamg->data    = 0;
 
   /* register AMG type */
-#if !defined(PETSC_USE_DYNAMIC_LIBRARIES)
   ierr = PCGAMGInitializePackage();CHKERRQ(ierr);
-#endif
 
   /* overwrite the pointers of PCMG by the functions of base class PCGAMG */
   pc->ops->setfromoptions = PCSetFromOptions_GAMG;

File src/ksp/pc/interface/precon.c

   PetscFunctionBegin;
   PetscValidPointer(newpc,1);
   *newpc = 0;
-#if !defined(PETSC_USE_DYNAMIC_LIBRARIES)
   ierr = PCInitializePackage();CHKERRQ(ierr);
-#endif
 
   ierr = PetscHeaderCreate(pc,_p_PC,struct _PCOps,PC_CLASSID,"PC","Preconditioner","PC",comm,PCDestroy,PCView);CHKERRQ(ierr);
 

File src/mat/coarsen/coarsen.c

   PetscFunctionBegin;
   *newcrs = 0;
 
-#if !defined(PETSC_USE_DYNAMIC_LIBRARIES)
   ierr = MatInitializePackage();CHKERRQ(ierr);
-#endif
   ierr = PetscHeaderCreate(agg, _p_MatCoarsen, struct _MatCoarsenOps, MAT_COARSEN_CLASSID,"MatCoarsen","Matrix/graph coarsen",
                            "MatCoarsen", comm, MatCoarsenDestroy, MatCoarsenView);CHKERRQ(ierr);
 

File src/mat/impls/mffd/mffd.c

   PetscErrorCode ierr;
 
   PetscFunctionBegin;
-#if !defined(PETSC_USE_DYNAMIC_LIBRARIES)
   ierr = MatMFFDInitializePackage();CHKERRQ(ierr);
-#endif
 
   ierr = PetscHeaderCreate(mfctx,_p_MatMFFD,struct _MFOps,MATMFFD_CLASSID,"MatMFFD","Matrix-free Finite Differencing","Mat",PetscObjectComm((PetscObject)A),MatDestroy_MFFD,MatView_MFFD);CHKERRQ(ierr);
 

File src/mat/interface/dlregismat.c

   PetscFunctionReturn(0);
 }
 
-#if defined(PETSC_USE_DYNAMIC_LIBRARIES)
+#if defined(PETSC_HAVE_DYNAMIC_LIBRARIES)
 #undef __FUNCT__
 #define __FUNCT__ "PetscDLLibraryRegister_petscmat"
 /*
 }
 
 
-#endif /* PETSC_USE_DYNAMIC_LIBRARIES */
+#endif /* PETSC_HAVE_DYNAMIC_LIBRARIES */

File src/mat/interface/matnull.c

   PetscValidPointer(SP,5);
 
   *SP = NULL;
-#if !defined(PETSC_USE_DYNAMIC_LIBRARIES)
   ierr = MatInitializePackage();CHKERRQ(ierr);
-#endif
 
   ierr = PetscHeaderCreate(sp,_p_MatNullSpace,int,MAT_NULLSPACE_CLASSID,"MatNullSpace","Null space","Mat",comm,MatNullSpaceDestroy,MatNullSpaceView);CHKERRQ(ierr);
 

File src/mat/partition/partition.c

   PetscFunctionBegin;
   *newp = 0;
 
-#if !defined(PETSC_USE_DYNAMIC_LIBRARIES)
   ierr = MatInitializePackage();CHKERRQ(ierr);
-#endif
   ierr = PetscHeaderCreate(part,_p_MatPartitioning,struct _MatPartitioningOps,MAT_PARTITIONING_CLASSID,"MatPartitioning","Matrix/graph partitioning","MatOrderings",comm,MatPartitioningDestroy,MatPartitioningView);CHKERRQ(ierr);
   part->vertex_weights = NULL;
   part->part_weights   = NULL;

File src/mat/utils/gcreate.c

   PetscValidPointer(A,2);
 
   *A = NULL;
-#if !defined(PETSC_USE_DYNAMIC_LIBRARIES)
   ierr = MatInitializePackage();CHKERRQ(ierr);
-#endif
 
   ierr = PetscHeaderCreate(B,_p_Mat,struct _MatOps,MAT_CLASSID,"Mat","Matrix","Mat",comm,MatDestroy,MatView);CHKERRQ(ierr);
   ierr = PetscLayoutCreate(comm,&B->rmap);CHKERRQ(ierr);

File src/snes/impls/ms/ms.c

   SNES_MS        *ms;
 
   PetscFunctionBegin;
-#if !defined(PETSC_USE_DYNAMIC_LIBRARIES)
   ierr = SNESMSInitializePackage();CHKERRQ(ierr);
-#endif
 
   snes->ops->setup          = SNESSetUp_MS;
   snes->ops->solve          = SNESSolve_MS;

File src/snes/interface/dlregissnes.c

   PetscFunctionReturn(0);
 }
 
-#if defined(PETSC_USE_DYNAMIC_LIBRARIES)
+#if defined(PETSC_HAVE_DYNAMIC_LIBRARIES)
 #undef __FUNCT__
 #define __FUNCT__ "PetscDLLibraryRegister_petscsnes"
 /*
   PetscFunctionReturn(0);
 }
 
-#endif /* PETSC_USE_DYNAMIC_LIBRARIES */
+#endif /* PETSC_HAVE_DYNAMIC_LIBRARIES */

File src/snes/interface/snes.c

   PetscFunctionBegin;
   PetscValidPointer(outsnes,2);
   *outsnes = NULL;
-#if !defined(PETSC_USE_DYNAMIC_LIBRARIES)
   ierr = SNESInitializePackage();CHKERRQ(ierr);
-#endif
 
   ierr = PetscHeaderCreate(snes,_p_SNES,struct _SNESOps,SNES_CLASSID,"SNES","Nonlinear solver","SNES",comm,SNESDestroy,SNESView);CHKERRQ(ierr);
 

File src/snes/utils/dmsnes.c

   PetscErrorCode ierr;
 
   PetscFunctionBegin;
-#if !defined(PETSC_USE_DYNAMIC_LIBRARIES)
   ierr = SNESInitializePackage();CHKERRQ(ierr);
-#endif
   ierr = PetscHeaderCreate(*kdm, _p_DMSNES, struct _DMSNESOps, DMSNES_CLASSID,  "DMSNES", "DMSNES", "DMSNES", comm, DMSNESDestroy, DMSNESView);CHKERRQ(ierr);
   ierr = PetscMemzero((*kdm)->ops, sizeof(struct _DMSNESOps));CHKERRQ(ierr);
   PetscFunctionReturn(0);

File src/sys/classes/draw/interface/drawreg.c

   PetscBool      flag;
 
   PetscFunctionBegin;
-#if !defined(PETSC_USE_DYNAMIC_LIBRARIES)
   ierr = PetscDrawInitializePackage();CHKERRQ(ierr);
-#endif
   *indraw = 0;
   ierr = PetscHeaderCreate(draw,_p_PetscDraw,struct _PetscDrawOps,PETSC_DRAW_CLASSID,"Draw","Graphics","Draw",comm,PetscDrawDestroy,0);CHKERRQ(ierr);
 

File src/sys/classes/random/interface/randomc.c

   PetscFunctionBegin;
   PetscValidPointer(r,3);
   *r = NULL;
-#if !defined(PETSC_USE_DYNAMIC_LIBRARIES)
   ierr = PetscRandomInitializePackage();CHKERRQ(ierr);
-#endif
 
   ierr = PetscHeaderCreate(rr,_p_PetscRandom,struct _PetscRandomOps,PETSC_RANDOM_CLASSID,"PetscRandom","Random number generator","Sys",comm,PetscRandomDestroy,0);CHKERRQ(ierr);
 

File src/sys/classes/viewer/impls/mathematica/mathematica.c

   PetscErrorCode          ierr;
 
   PetscFunctionBegin;
-#if !defined(PETSC_USE_DYNAMIC_LIBRARIES)
   ierr = PetscViewerMathematicaInitializePackage();CHKERRQ(ierr);
-#endif
 
   ierr            = PetscNewLog(v,PetscViewer_Mathematica, &vmath);CHKERRQ(ierr);
   v->data         = (void*) vmath;

File src/sys/classes/viewer/interface/dlregispetsc.c

   PetscFunctionReturn(0);
 }
 
-#if defined(PETSC_USE_DYNAMIC_LIBRARIES)
+#if defined(PETSC_HAVE_DYNAMIC_LIBRARIES)
 
 #if defined(PETSC_USE_SINGLE_LIBRARY)
 PETSC_EXTERN PetscErrorCode PetscDLLibraryRegister_petscvec(void);
 #endif
   PetscFunctionReturn(0);
 }
-#endif
-
-
+#endif  /* PETSC_HAVE_DYNAMIC_LIBRARIES */

File src/sys/classes/viewer/interface/viewreg.c

 
   PetscFunctionBegin;
   *inviewer = 0;
-#if !defined(PETSC_USE_DYNAMIC_LIBRARIES)
   ierr = PetscViewerInitializePackage();CHKERRQ(ierr);
-#endif
   ierr         = PetscHeaderCreate(viewer,_p_PetscViewer,struct _PetscViewerOps,PETSC_VIEWER_CLASSID,"PetscViewer","PetscViewer","Viewer",comm,PetscViewerDestroy,0);CHKERRQ(ierr);
   *inviewer    = viewer;
   viewer->data = 0;

File src/sys/dll/dlimpl.c

 #endif
     }
 #endif
-#endif /* PETSC_HAVE_DLOPEN && PETSC_USE_DYNAMIC_LIBRARIES */
+#endif /* PETSC_HAVE_DLOPEN && PETSC_HAVE_DYNAMIC_LIBRARIES */
   }
 #if defined(PETSC_HAVE_DLERROR)
   dlerror(); /* clear any previous error */

File src/sys/dll/reg.c

 */
 PetscDLLibrary PetscDLLibrariesLoaded = 0;
 
-#if defined(PETSC_USE_DYNAMIC_LIBRARIES)
+#if defined(PETSC_HAVE_DYNAMIC_LIBRARIES)
 
 #undef __FUNCT__
 #define __FUNCT__ "PetscLoadDynamicLibrary"
   char           *libname[32];
   PetscErrorCode ierr;
   PetscInt       nmax,i;
-#if defined(PETSC_USE_DYNAMIC_LIBRARIES)
-  PetscBool      found;
+#if defined(PETSC_HAVE_DYNAMIC_LIBRARIES)
+  PetscBool      preload;
 #endif
 
   PetscFunctionBegin;
     ierr = PetscFree(libname[i]);CHKERRQ(ierr);
   }
 
-#if !defined(PETSC_USE_DYNAMIC_LIBRARIES)
+#if !defined(PETSC_HAVE_DYNAMIC_LIBRARIES)
   /*
       This just initializes the most basic PETSc stuff.
 
   */
   ierr = PetscSysInitializePackage();CHKERRQ(ierr);
 #else
+  preload = PETSC_FALSE;
+  ierr = PetscOptionsGetBool(NULL,"-dynamic_library_preload",&preload,NULL);CHKERRQ(ierr);
+  if (preload) {
+    PetscBool found;
 #if defined(PETSC_USE_SINGLE_LIBRARY)
-  ierr = PetscLoadDynamicLibrary("",&found);CHKERRQ(ierr);
-  if (!found) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_FILE_OPEN,"Unable to locate PETSc dynamic library \n You cannot move the dynamic libraries!");
+    ierr = PetscLoadDynamicLibrary("",&found);CHKERRQ(ierr);
+    if (!found) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_FILE_OPEN,"Unable to locate PETSc dynamic library \n You cannot move the dynamic libraries!");
 #else
-  ierr = PetscLoadDynamicLibrary("sys",&found);CHKERRQ(ierr);
-  if (!found) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_FILE_OPEN,"Unable to locate PETSc dynamic library \n You cannot move the dynamic libraries!");
-  ierr = PetscLoadDynamicLibrary("vec",&found);CHKERRQ(ierr);
-  if (!found) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_FILE_OPEN,"Unable to locate PETSc Vec dynamic library \n You cannot move the dynamic libraries!");
-  ierr = PetscLoadDynamicLibrary("mat",&found);CHKERRQ(ierr);
-  if (!found) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_FILE_OPEN,"Unable to locate PETSc Mat dynamic library \n You cannot move the dynamic libraries!");
-  ierr = PetscLoadDynamicLibrary("dm",&found);CHKERRQ(ierr);
-  if (!found) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_FILE_OPEN,"Unable to locate PETSc DM dynamic library \n You cannot move the dynamic libraries!");
-  ierr = PetscLoadDynamicLibrary("ksp",&found);CHKERRQ(ierr);
-  if (!found) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_FILE_OPEN,"Unable to locate PETSc KSP dynamic library \n You cannot move the dynamic libraries!");
-  ierr = PetscLoadDynamicLibrary("snes",&found);CHKERRQ(ierr);
-  if (!found) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_FILE_OPEN,"Unable to locate PETSc SNES dynamic library \n You cannot move the dynamic libraries!");
-  ierr = PetscLoadDynamicLibrary("ts",&found);CHKERRQ(ierr);
-  if (!found) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_FILE_OPEN,"Unable to locate PETSc TS dynamic library \n You cannot move the dynamic libraries!");
+    ierr = PetscLoadDynamicLibrary("sys",&found);CHKERRQ(ierr);
+    if (!found) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_FILE_OPEN,"Unable to locate PETSc dynamic library \n You cannot move the dynamic libraries!");
+    ierr = PetscLoadDynamicLibrary("vec",&found);CHKERRQ(ierr);
+    if (!found) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_FILE_OPEN,"Unable to locate PETSc Vec dynamic library \n You cannot move the dynamic libraries!");
+    ierr = PetscLoadDynamicLibrary("mat",&found);CHKERRQ(ierr);
+    if (!found) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_FILE_OPEN,"Unable to locate PETSc Mat dynamic library \n You cannot move the dynamic libraries!");
+    ierr = PetscLoadDynamicLibrary("dm",&found);CHKERRQ(ierr);
+    if (!found) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_FILE_OPEN,"Unable to locate PETSc DM dynamic library \n You cannot move the dynamic libraries!");
+    ierr = PetscLoadDynamicLibrary("ksp",&found);CHKERRQ(ierr);
+    if (!found) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_FILE_OPEN,"Unable to locate PETSc KSP dynamic library \n You cannot move the dynamic libraries!");
+    ierr = PetscLoadDynamicLibrary("snes",&found);CHKERRQ(ierr);
+    if (!found) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_FILE_OPEN,"Unable to locate PETSc SNES dynamic library \n You cannot move the dynamic libraries!");
+    ierr = PetscLoadDynamicLibrary("ts",&found);CHKERRQ(ierr);
+    if (!found) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_FILE_OPEN,"Unable to locate PETSc TS dynamic library \n You cannot move the dynamic libraries!");
 #endif
+  }
 #endif
 
   nmax = 32;

File src/sys/logging/utils/classlog.c

     /* Could do bisection here */
     if (classLog->classInfo[c].classid == classid) break;
   }
-  if (c >= classLog->numClasses) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONG, "Invalid object classid %d\nThis often happens if you compile with PETSC_USE_DYNAMIC_LIBRARIES, but link with static libraries.", classid);
+  if (c >= classLog->numClasses) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONG, "Invalid object classid %d\nThis could happen if you compile with PETSC_HAVE_DYNAMIC_LIBRARIES, but link with static libraries.", classid);
   *oclass = c;
   PetscFunctionReturn(0);
 }

File src/sys/objects/inherit.c

 
   PetscFunctionBegin;
   PetscValidPointer(container,2);
+  ierr = PetscSysInitializePackage();CHKERRQ(ierr);
   ierr = PetscHeaderCreate(contain,_p_PetscContainer,PetscInt,PETSC_CONTAINER_CLASSID,"PetscContainer","Container","Sys",comm,PetscContainerDestroy,0);CHKERRQ(ierr);
   *container = contain;
   PetscFunctionReturn(0);

File src/ts/characteristic/interface/characteristic.c

   PetscFunctionBegin;
   PetscValidPointer(c, 2);
   *c = NULL;
-#if !defined(PETSC_USE_DYNAMIC_LIBRARIES)
   ierr = CharacteristicInitializePackage();CHKERRQ(ierr);
-#endif
 
   ierr = PetscHeaderCreate(newC, _p_Characteristic, struct _CharacteristicOps, CHARACTERISTIC_CLASSID, "Characteristic", "Characteristic", "SemiLagrange", comm, CharacteristicDestroy, CharacteristicView);CHKERRQ(ierr);
   ierr = PetscLogObjectCreate(newC);CHKERRQ(ierr);

File src/ts/characteristic/interface/slregis.c

   PetscFunctionReturn(0);
 }
 
-#if defined(PETSC_USE_DYNAMIC_LIBRARIES)
+#if defined(PETSC_HAVE_DYNAMIC_LIBRARIES)
 #undef __FUNCT__
 #define __FUNCT__ "PetscDLLibraryRegister_characteristic"
 /*
   PetscFunctionReturn(0);
 }
 
-#endif /* PETSC_USE_DYNAMIC_LIBRARIES */
+#endif /* PETSC_HAVE_DYNAMIC_LIBRARIES */

File src/ts/impls/arkimex/arkimex.c

   PetscErrorCode ierr;
 
   PetscFunctionBegin;
-#if !defined(PETSC_USE_DYNAMIC_LIBRARIES)
   ierr = TSARKIMEXInitializePackage();CHKERRQ(ierr);
-#endif
 
   ts->ops->reset          = TSReset_ARKIMEX;
   ts->ops->destroy        = TSDestroy_ARKIMEX;

File src/ts/impls/explicit/ssp/ssp.c

   PetscErrorCode ierr;
 
   PetscFunctionBegin;
-#if !defined(PETSC_USE_DYNAMIC_LIBRARIES)
   ierr = TSSSPInitializePackage();CHKERRQ(ierr);
-#endif
 
   ts->ops->setup          = TSSetUp_SSP;
   ts->ops->step           = TSStep_SSP;