[petsc-dev] To add a PETSc dependent package to PETSc as an external package.

Xuefei (Rebecca) Yuan xyuan at lbl.gov
Wed Aug 17 20:31:43 CDT 2011


Dear all,

I have a problem for compile PDSLin with PETSc, the configure.log says

------------------------------------------------------
======                      Compiling PDSLin; this may take several minutes                  ===============================================================================
sh: cd /scratch2/scratchdirs/xyuan/Software_Hopper/petsc-dev/externalpackages/pdslin_0.0 &&
 PDSLIN_INSTALL_DIR=/scratch2/scratchdirs/xyuan/Software_Hopper/petsc-dev/arch-cray-xt6-pkgs-opt-doubleprecision-pdslin/lib && export PDSLIN_INSTALL_DIR && make clean && make lib LAAUX="" && mv -f *.a /scratch2/scratchdirs/xyuan/Software_Hopper/petsc-dev/arch-cray-xt6-pkgs-opt-doubleprecision-pdslin/lib && cp -f include/*.h /scratch2/scratchdirs/xyuan/Software_Hopper/petsc-dev/arch-cray-xt6-pkgs-opt-doubleprecision-pdslin/include/.Executing: cd /scratch2/scratchdirs/xyuan/Software_Hopper/petsc-dev/externalpackages/pdslin_0.0 && PDSLIN_INSTALL_DIR=/scratch2/scratchdirs/xyuan/Software_Hopper/petsc-dev/arch-cray-
xt6-pkgs-opt-doubleprecision-pdslin/lib && export PDSLIN_INSTALL_DIR && make clean && make lib LAAUX="" && mv -f *.a /scratch2/scratchdirs/xyuan/Software_Hopper/petsc-dev/arch-cray-xt6-pkgs-opt-doubleprecision-pdslin/lib && cp -f include/*.h /scratch2/scratchdirs/xyuan/Software_Hopper/petsc-dev/arch-cray-xt6-pkgs-opt-doubleprecision-pdslin/include/.
sh: (cd src/; make clean; cd /scratch2/scratchdirs/xyuan/Software_Hopper/petsc-dev/externalpackages/pdslin_0.0/fortran; make clean; cd /scratch2/scratchdirs/xyuan/Software_Hopper/pet
sc-dev/externalpackages/pdslin_0.0/fortran/examples; make clean; cd /scratch2/scratchdirs/x
yuan/Software_Hopper/petsc-dev/externalpackages/pdslin_0.0/examples; make clean; rm -f ; )

make[1]: Entering directory `/scratch2/scratchdirs/xyuan/Software_Hopper/petsc-dev/externalpackages/pdslin_0.0/src'
( rm -f *.o; rm -f ./slu/*.o;)
make[1]: Leaving directory `/scratch2/scratchdirs/xyuan/Software_Hopper/petsc-dev/externalpackages/pdslin_0.0/src'
make[1]: Entering directory `/scratch2/scratchdirs/xyuan/Software_Hopper/petsc-dev/externalpackages/pdslin_0.0/fortran'
(rm -f *.o; rm -f *.mod;)
make[1]: Leaving directory `/scratch2/scratchdirs/xyuan/Software_Hopper/petsc-dev/externalpackages/pdslin_0.0/fortran'
make[1]: Entering directory `/scratch2/scratchdirs/xyuan/Software_Hopper/petsc-dev/externalpackages/pdslin_0.0/fortran/examples'
(rm -f *.o; rm -f *.mod; rm -f dtest_pdslinf; rm -f ztest_pdslinf;)
make[1]: Leaving directory `/scratch2/scratchdirs/xyuan/Software_Hopper/petsc-dev/externalpackages/pdslin_0.0/fortran/examples'
make[1]: Entering directory `/scratch2/scratchdirs/xyuan/Software_Hopper/petsc-dev/externalpackages/pdslin_0.0/examples'
(rm -f *.o; rm -f *.dat; rm -f dtest_pdslin; rm -f ztest_pdslin; rm -f dtest; rm -f ztest;)
make[1]: Leaving directory `/scratch2/scratchdirs/xyuan/Software_Hopper/petsc-dev/externalpackages/pdslin_0.0/examples'
make: Nothing to be done for `lib'.

*******************************************************************************
         UNABLE to CONFIGURE with GIVEN OPTIONS    (see configure.log for details):
-------------------------------------------------------------------------------
Error running make on PDSLIN: Could not execute "cd /scratch2/scratchdirs/xyuan/Software_Hopper/petsc-dev/externalpackages/pdslin_0.0 && PDSLIN_INSTALL_DIR=/scratch2/scratchdirs/xyuan/Software_Hopper/petsc-dev/arch-cray-xt6-pkgs-opt-doubleprecision-pdslin/lib && export PDSLIN_INSTALL_DIR && make clean && make lib LAAUX="" && mv -f *.a /scratch2/scratchdirs/xyuan/Software_Hopper/petsc-dev/arch-cray-xt6-pkgs-opt-doubleprecision-pdslin/lib && cp -f include/*.h /scratch2/scratchdirs/xyuan/Software_Hopper/petsc-dev/arch-cray-xt6-pkgs-opt-doubleprecision-pdslin/include/.":
(cd src/; make clean; cd /scratch2/scratchdirs/xyuan/Software_Hopper/petsc-dev/externalpackages/pdslin_0.0/fortran; make clean; cd /scratch2/scratchdirs/xyuan/Software_Hopper/petsc-dev/externalpackages/pdslin_0.0/fortran/examples; make clean; cd /scratch2/scratchdirs/xyuan/Software_Hopper/petsc-dev/externalpackages/pdslin_0.0/examples; make clean; rm -f ; )
make[1]: Entering directory `/scratch2/scratchdirs/xyuan/Software_Hopper/petsc-dev/externalpackages/pdslin_0.0/src'
( rm -f *.o; rm -f ./slu/*.o;)
make[1]: Leaving directory `/scratch2/scratchdirs/xyuan/Software_Hopper/petsc-dev/externalpackages/pdslin_0.0/src'
make[1]: Entering directory `/scratch2/scratchdirs/xyuan/Software_Hopper/petsc-dev/externalpackages/pdslin_0.0/fortran'
(rm -f *.o; rm -f *.mod; rm -f dtest_pdslinf; rm -f ztest_pdslinf;)
make[1]: Leaving directory `/scratch2/scratchdirs/xyuan/Software_Hopper/petsc-dev/externalpackages/pdslin_0.0/fortran/examples'
make[1]: Entering directory `/scratch2/scratchdirs/xyuan/Software_Hopper/petsc-dev/external
packages/pdslin_0.0/examples'
(rm -f *.o; rm -f *.dat; rm -f dtest_pdslin; rm -f ztest_pdslin; rm -f dtest; rm -f ztest;)
make[1]: Leaving directory `/scratch2/scratchdirs/xyuan/Software_Hopper/petsc-dev/externalpackages/pdslin_0.0/examples'
make: Nothing to be done for `lib'.
mv: cannot stat `*.a': No such file or directory*******************************************************************************
  File "/scratch2/scratchdirs/xyuan/Software_Hopper/petsc-dev/config/configure.py", line 27
2, in petsc_configure    framework.configure(out = sys.stdout)
  File "/scratch2/scratchdirs/xyuan/Software_Hopper/petsc-dev/config/BuildSystem/config/fra
mework.py", line 925, in configure    child.configure()
  File "/scratch2/scratchdirs/xyuan/Software_Hopper/petsc-dev/config/BuildSystem/config/package.py", line 500, in configure
    self.executeTest(self.configureLibrary)
  File "/scratch2/scratchdirs/xyuan/Software_Hopper/petsc-dev/config/BuildSystem/config/base.py", line 115, in executeTest
    ret = apply(test, args,kargs)
  File "/scratch2/scratchdirs/xyuan/Software_Hopper/petsc-dev/config/BuildSystem/config/package.py", line 427, in configureLibrary
    for location, directory, lib, incl in self.generateGuesses():
  File "/scratch2/scratchdirs/xyuan/Software_Hopper/petsc-dev/config/BuildSystem/config/package.py", line 223, in generateGuesses
    d = self.checkDownload(1)
  File "/scratch2/scratchdirs/xyuan/Software_Hopper/petsc-dev/config/BuildSystem/config/package.py", line 308, in checkDownload
    return self.getInstallDir()
  File "/scratch2/scratchdirs/xyuan/Software_Hopper/petsc-dev/config/BuildSystem/config/package.py", line 181, in getInstallDir
    return os.path.abspath(self.Install())
  File "/scratch2/scratchdirs/xyuan/Software_Hopper/petsc-dev/config/PETSc/packages/PDSLin.py", line 74, in Install
    raise RuntimeError('Error running make on PDSLIN: '+str(e))



-----------------------------------------------------
I started to copy and paste the error message including commands:


Error running make on PDSLIN: Could not execute "cd /scratch2/scratchdirs/xyuan/Software_Hopper/petsc-dev/externalpackages/pdslin_0.0 && PDSLIN_INSTALL_DIR=/scratch2/scratchdirs/xyuan/Software_Hopper/petsc-dev/arch-cray-xt6-pkgs-opt-doubleprecision-pdslin/lib && export PDSLIN_INSTALL_DIR && make clean && make lib LAAUX="" && mv -f *.a /scratch2/scratchdirs/xyuan/Software_Hopper/petsc-dev/arch-cray-xt6-pkgs-opt-doubleprecision-pdslin/lib && cp -f include/*.h /scratch2/scratchdirs/xyuan/Software_Hopper/petsc-dev/arch-cray-xt6-pkgs-opt-doubleprecision-pdslin/include/.":


And found that 

Software_Hopper/petsc-dev> cd /scratch2/scratchdirs/xyuan/Software_Hopper/petsc-dev/externalpackages/pdslin_0.0
Directory: /scratch2/scratchdirs/xyuan/Software_Hopper/petsc-dev/externalpackages/pdslin_0.0
externalpackages/pdslin_0.0> PDSLIN_INSTALL_DIR=/scratch2/scratchdirs/xyuan/Software_Hopper/petsc-dev/arch-cray-xt6-pkgs-opt-doubleprecision-pdslin/lib
PDSLIN_INSTALL_DIR=/scratch2/scratchdirs/xyuan/Software_Hopper/petsc-dev/arch-cray-xt6-pkgs-opt-doubleprecision-pdslin/lib: Command not found.
externalpackages/pdslin_0.0> 

Then I realized that it is a csh not a bash. However, there is no error message for other packages, such as SuperLU_DIST. My PDSLin.py looks like (modified from SuperLU_DIST.py):


-------------------------------------
import PETSc.package

class Configure(PETSc.package.NewPackage):
  def __init__(self, framework):    PETSc.package.NewPackage.__init__(self, framework)
    self.downloadname   = self.name.lower()
    self.download   = ['http://portal.nersc.gov/project/nerscpd/pdslin_0.0.tar.gz']
    self.functions  = ['dpdslin_solver']
    self.includes   = ['dpdslin_solver.h']
    self.liblist    = [['libpdslin.a']]
    #
    #  PDSLin supports 64 bit integers but uses ParMetis which does not, see the comment in
 ParMetis.py
    #  in the method configureLibrary()
    self.requires32bitint = 0
    self.complex          = 1
    return
  def setupDependencies(self, framework):
    PETSc.package.NewPackage.setupDependencies(self, framework)
    self.blasLapack = framework.require('config.packages.BlasLapack',self)
    self.parmetis   = framework.require('PETSc.packages.ParMetis',self)
    self.scotch     = framework.require('PETSc.packages.Scotch',self)
    self.superlu_dist   = framework.require('PETSc.packages.SuperLU_DIST',self)
    self.deps       = [self.mpi,self.blasLapack,self.parmetis,self.scotch,self.superlu_dist]
    return

  def Install(self):
    import os
    import sys

    g = open(os.path.join(self.packageDir,'make.inc'),'w')
    g.write('SHELL          = '+self.programs.SHELL+'\n')
    g.write('DPDSLINroot = '+self.packageDir+'\n')
    g.write('HOME  = $(DPDSLINroot)\n')
    g.write('DPDSLINLIB  = $(DPDSLINroot)/lib/libpdslin.a\n')
    g.write('BLASDEF      = -DUSE_VENDOR_BLAS\n')
    g.write('BLASLIB      = '+self.libraries.toString(self.blasLapack.dlib)+'\n')
    g.write('IMPI         = '+self.headers.toString(self.mpi.include)+'\n')
    g.write('MPILIB       = '+self.libraries.toString(self.mpi.lib)+'\n')
    g.write('PMETISLIB    = '+self.libraries.toString(self.parmetis.lib)+'\n')
    g.write('PSCOTCHLIB    = '+self.libraries.toString(self.scotch.lib)+'\n')
    g.write('SUPERLUDISTLIB    = '+self.libraries.toString(self.superlu_dist.lib)+'\n')
    g.write('LIBS         = $(DPDSLINLIB) $(BLASLIB) $(PMETISLIB) $(MPILIB) $(PSCOTCHLIB) $(SUPERLUDISTLIB)\n')
    g.write('ARCH         = '+self.setCompilers.AR+'\n')
    g.write('ARCHFLAGS    = '+self.setCompilers.AR_FLAGS+'\n')
    g.write('RANLIB       = '+self.setCompilers.RANLIB+'\n')
    self.setCompilers.pushLanguage('C')
    g.write('CC           = '+self.setCompilers.getCompiler()+' $(IMPI)\n') #build fails without $(IMPI)
    g.write('CFLAGS       = '+self.setCompilers.getCompilerFlags()+'\n')
    g.write('LOADER       = '+self.setCompilers.getLinker()+'\n')
    g.write('LOADOPTS     = \n')
    self.setCompilers.popLanguage()
    # set blas/lapack name mangling
    if self.blasLapack.mangling == 'underscore':
      g.write('CDEFS   = -DAdd_')
    elif self.blasLapack.mangling == 'caps':
      g.write('CDEFS   = -DUpCase')
    else:
      g.write('CDEFS   = -DNoChange')
    if self.framework.argDB['with-64-bit-indices']:
      g.write(' -D_LONGINT')
    g.write('\n')
    # not sure what this is for
    g.write('NOOPTS       = '+self.blasLapack.getSharedFlag(self.setCompilers.getCompilerFlags())+' '+self.blasLapack.getPrecisionFlag(self.setCompilers.getCompilerFlags())+' '+self.blasLapack.getWindowsNonOptFlags(self.setCompilers.getCompilerFlags())+'\n')
    g.close()

    if self.installNeeded('make.inc'):
      try:
        self.logPrintBox('Compiling PDSLin; this may take several minutes')
        if not os.path.exists(os.path.join(self.packageDir,'lib')):
          os.makedirs(os.path.join(self.packageDir,'lib'))
        output,err,ret  = PETSc.package.NewPackage.executeShellCommand('cd '+self.packageDir+' && PDSLIN_INSTALL_DIR='+self.installDir+'/lib && export PDSLIN_INSTALL_DIR && make clean && make lib LAAUX="" && mv -f *.a '+os.path.join(self.installDir,'lib')+' && cp -f include/*.h '+os.path.join(self.installDir,'include')+'/.', timeout=2500, log = self.framework.log)
      except RuntimeError, e:
        raise RuntimeError('Error running make on PDSLIN: '+str(e))
      self.postInstall(output+err,'make.inc')
    return self.installDir

  def consistencyChecks(self):
    PETSc.package.NewPackage.consistencyChecks(self)
    if self.framework.argDB['with-'+self.package]:
      if not self.blasLapack.checkForRoutine('slamch'):
        raise RuntimeError('PDSLin requires the BLAS routine slamch()')
      self.framework.log.write('Found slamch() in BLAS library as needed by PDSLin\n')
      if not self.blasLapack.checkForRoutine('dlamch'):
        raise RuntimeError('PDSLin requires the BLAS routine dlamch()')
      self.framework.log.write('Found dlamch() in BLAS library as needed by PDSLin\n')
      if not self.blasLapack.checkForRoutine('xerbla'):
        raise RuntimeError('PDSLin requires the BLAS routine xerbla()')
      self.framework.log.write('Found xerbla() in BLAS library as needed by PDSLin\n')
    return


------------------------------------

What could be wrong here?

Thanks very much!

Cheers,

Rebecca


On Aug 17, 2011, at 1:46 PM, Barry Smith wrote:

> 
>   Rebecca,
> 
>    It would probably be best if you email to petsc-maint the PDSLin tarball so we can look at the PDSlin structure and come up with the best way to proceed. The way to handle the packaging will depend on how PDSLin interacts with PETSc.
> 
>   Thanks
> 
>   Barry
> 
> On Aug 17, 2011, at 3:19 PM, Xuefei (Rebecca) Yuan wrote:
> 
>> Dear all,
>> 
>> We are trying to add a PETSc dependent package called PDSLin to PETSc as an external package. PDSLin is a hybrid linear solver and we would like to have it been imported to PETSc as SuperLU_DIST used to be, and it provides an alternative way to solving a linear system in parallel.
>> 
>> Even though the package has not been released yet (should be released soon) and it is under testing for some problems, we are still interesting in putting it as an external package to PETSc for now.
>> 
>> I did some search of the old threads to the petsc-dev team and there is a request from Lious for the PaStiX a few years ago.
>> 
>> My understanding to add a package is the following steps:
>> 
>> 1) create a python code called "PDSLin.py" under /petsc-dev/config/PETSc/packages
>> 
>> 2) write an interface file between PETSc and PDSLin.
>> 
>> As PDSLin is very similar to SuperLU_DIST, and it also depending on PETSc (similar to Prometheus), the PDSLin.py is created based on SuperLU_DIST.py and Prometheus.py. 
>> 
>> Before putting the interface file in some places under petsc-dev directory, would you please help me understand how those option calls go to this interface file?
>> 
>> a) am I missing another file to create/modify to have those options connected to PDSLin in a very similar way to SuperLU_DIST?
>> 
>> b) do I have some flexibility to add more options called from PETSc to this package?
>> 
>> Moreover, I am not sure how to put the interface file in the dev package.
>> 
>> c) where shall it go? The SuperLU_DIST is located at
>> 
>> ./src/mat/impls/aij/mpi/superlu_dist/superlu_dist.c
>> 
>> shall I put it as
>> 
>> ./src/mat/impls/aij/mpi/pdslin/pdslin.c  ?
>> 
>> d) what is the rule of writing this interface file?
>> 
>> In superlu_dist.c, the extern functions are
>> 
>> extern PetscErrorCode MatFactorInfo_SuperLU_DIST(Mat,PetscViewer);
>> extern PetscErrorCode MatLUFactorNumeric_SuperLU_DIST(Mat,Mat,const MatFactorInfo *);
>> extern PetscErrorCode MatDestroy_SuperLU_DIST(Mat);
>> extern PetscErrorCode MatView_SuperLU_DIST(Mat,PetscViewer);
>> extern PetscErrorCode MatSolve_SuperLU_DIST(Mat,Vec,Vec);
>> extern PetscErrorCode MatLUFactorSymbolic_SuperLU_DIST(Mat,Mat,IS,IS,const MatFactorInfo *);
>> extern PetscErrorCode MatDestroy_MPIAIJ(Mat);
>> 
>> What kind of functions should I have in the interface file for PDSLin?
>> 
>> I am not sure if I have stated the problem clearly, in short is that we would like to add some package to PETSc but not sure the right way and steps to approach the goal.
>> 
>> Thanks very much!
>> 
>> Best regards,
>> 
>> Rebecca
>> 
>> Xuefei (Rebecca) Yuan
>> Postdoctoral Fellow
>> Lawrence Berkeley National Laboratory
>> Tel: 1-510-486-7031
>> 
>> 
> 




More information about the petsc-dev mailing list