framework.Frame Class Reference
+ Inheritance diagram for framework.Frame:

Public Member Functions

def __init__ (self, argv)
 
def usage (self)
 
def parse_args (self, argv)
 
def look_for_mpibinaries (self)
 
def look_for_mpih (self)
 
def check_mpicc (self)
 
def check_mpif77 (self)
 
def set_mangling (self)
 
def check_linking (self)
 
def set_download (self)
 
def set_ranlib (self)
 
def detect_compilers (self)
 
def fc_is_intel (self)
 
def fc_is_gnu (self)
 
def fc_is_pgi (self)
 
def cc_is_intel (self)
 
def cc_is_gnu (self)
 
def cc_is_pgi (self)
 
def resume (self)
 
def cleanup (self)
 

Static Public Attributes

string prefix = ''
 
 ccflags
 
 fcflags
 
 noopt
 
string mpibindir = ''
 
string mpiincdir = ''
 
 mpicc
 
 mpif77
 
string make = 'make'
 
string plat = 'LINUX'
 
string mangling = ''
 
string blaslib = ''
 
string blacslib = ''
 
string blacsClib = ''
 
string blacsF77lib = ''
 
string lapacklib = ''
 
string scalapacklib = ''
 
int proxy = 0
 
int downblas = 0
 
int downblacs = 1
 
int downlapack = 0
 
string ldflags_c = ''
 
string ldflags_f77 = ''
 
int testing = 1
 
string downcmd = ''
 
string blasurl = 'http://netlib.org/blas/blas.tgz'
 
string lapackurl = 'http://netlib.org/lapack/lapack.tgz'
 
string blacsurl = 'http://netlib.org/blacs/mpiblacs.tgz'
 
string scalapackurl = 'http://netlib.org/scalapack/scalapack-1.8.0.tgz'
 
string ranlib = ''
 
int clean = 0
 

Detailed Description

 This class takes care of the BLACS installation. 

Constructor & Destructor Documentation

◆ __init__()

def framework.Frame.__init__ (   self,
  argv 
)
48  def __init__(self, argv):
49 
50  print('='*40)
51  print('Setting up the framework\n')
52 
53 
54  # parse input arguments
55  self.parse_args(argv)
56 
57  if(Frame.clean == 1):
58  self.cleanup()
59  sys.exit()
60 
61  if(Frame.prefix != ''):
62  if(not os.path.isdir(os.path.join(os.getcwd(),Frame.prefix))):
63  print("Creating directory",Frame.prefix)
64  os.mkdir(os.path.join(os.getcwd(),Frame.prefix))
65  os.chdir(Frame.prefix)
66 
67  if(Frame.mpicc=='' or Frame.mpif77==''):
68  # if no MPI compilers are provided, look for them in mpibindir or in PATH
69  if(not self.look_for_mpibinaries()):
70  print("""
71 MPI C and Fortran77 compilers are needed to complete
72 the installation. You can specify the using the --mpibindir
73 or the --mpicc and --mpif77 flags.""")
74  sys.exit()
75 
76  if(Frame.mpiincdir==''):
77  # the path to the mpi.h file is needed
78  if(not self.look_for_mpih()):
79  print('Please provide the location for mpi.h file using the --mpiincdir flag')
80  sys.exit()
81 
82  # if testing has to be done, BLAS, BLACS andLAPACK are required
83  if(Frame.testing == 1):
84  if(Frame.blaslib == '' and Frame.downblas == 0):
85  print("""
86 Please provide a working BLAS library. If a BLAS library
87 is not present on the system, the reference BLAS library it can be
88 automatically downloaded and installed by adding the --downblas flag.
89 Be aware that a reference BLAS library will be installed with the --downblas
90 flag so don't expect performance.
91 The BLAS library is not needed in the case where testing is disabled
92 by means of the --notesting flag.
93  """)
94  sys.exit()
95  if((Frame.blacslib == '' or Frame.blacsClib == '' or Frame.blacsF77lib == '') and Frame.downblacs == 0):
96  print("""
97 Please provide a working BLACS library. If a BLACS library
98 is not present on the system, it can be automatically downloaded and
99 installed by adding the --downblacs flag. The BLAS library is not
100 needed in the case where testing is disabled by means of the
101 --notesting flag.
102  """)
103  sys.exit()
104  if(Frame.lapacklib == '' and Frame.downlapack == 0):
105  print("""
106 Please provide a working LAPACK library. If a LAPACK library
107 is not present on the system, it can be automatically downloaded and
108 installed by adding the --downlapack flag. The BLAS library is not
109 needed in the case where testing is disabled by means of the
110 --notesting flag.
111  """)
112  sys.exit()
113 
114 
115  # CUSTOM CHECKS
116  self.check_mpicc()
117  self.check_mpif77()
118  self.set_mangling()
119  self.set_download()
120  self.set_ranlib()
121  self.detect_compilers()
122  self.check_linking()
123 
124  return
125 
126 
if(UPLO(*uplo)==INVALID) info
Definition: level3_impl.h:428
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet print(const Packet &a)
Definition: GenericPacketMath.h:1166

References framework.Frame.check_linking(), framework.Frame.check_mpicc(), framework.Frame.check_mpif77(), ContactDetectionTester.cleanup(), ContactDetectionWithWallTester.cleanup(), Eigen::TensorEvaluator< const TensorIndexPairOp< ArgType >, Device >.cleanup(), Eigen::TensorEvaluator< const TensorPairReducerOp< ReduceOp, Dims, ArgType >, Device >.cleanup(), Eigen::TensorEvaluator< const TensorAssignOp< LeftArgType, RightArgType >, Device >.cleanup(), Eigen::internal::TensorMaterializedBlock< Scalar, NumDims, Layout, IndexType >.cleanup(), Eigen::internal::TensorCwiseUnaryBlock< UnaryOp, ArgTensorBlock >.cleanup(), Eigen::internal::TensorCwiseBinaryBlock< BinaryOp, LhsTensorBlock, RhsTensorBlock >.cleanup(), Eigen::internal::TensorUnaryExprBlock< BlockFactory, ArgTensorBlock >.cleanup(), Eigen::internal::TensorTernaryExprBlock< BlockFactory, Arg1TensorBlock, Arg2TensorBlock, Arg3TensorBlock >.cleanup(), Eigen::TensorEvaluator< const TensorBroadcastingOp< Broadcast, ArgType >, Device >.cleanup(), Eigen::TensorEvaluator< const TensorChippingOp< DimId, ArgType >, Device >.cleanup(), Eigen::TensorEvaluator< const TensorConcatenationOp< Axis, LeftArgType, RightArgType >, Device >.cleanup(), Eigen::TensorContractionEvaluatorBase< TensorEvaluator< const TensorContractionOp< Indices, LeftArgType, RightArgType, OutputKernelType >, Device > >.cleanup(), Eigen::TensorContractionEvaluatorBase< TensorEvaluator< const TensorContractionOp< Indices, LeftArgType, RightArgType, OutputKernelType >, Eigen::SyclDevice > >.cleanup(), Eigen::TensorContractionEvaluatorBase< Derived >.cleanup(), Eigen::TensorEvaluator< const TensorContractionOp< Indices, LeftArgType, RightArgType, OutputKernelType >, Eigen::SyclDevice >.cleanup(), Eigen::TensorEvaluator< const TensorConversionOp< TargetType, ArgType >, Device >.cleanup(), Eigen::TensorEvaluator< const TensorConvolutionOp< Indices, InputArgType, KernelArgType >, Device >.cleanup(), Eigen::TensorEvaluator< const TensorConvolutionOp< Indices, InputArgType, KernelArgType >, Eigen::SyclDevice >.cleanup(), Eigen::TensorEvaluator< const TensorCustomUnaryOp< CustomUnaryFunc, XprType >, Device >.cleanup(), Eigen::TensorEvaluator< const TensorCustomBinaryOp< CustomBinaryFunc, LhsXprType, RhsXprType >, Device >.cleanup(), Eigen::TensorEvaluator< const TensorEvalToOp< ArgType, MakePointer_ >, Device >.cleanup(), Eigen::TensorEvaluator< InputArgType, Device >.cleanup(), Eigen::TensorEvaluator< Derived, Device >.cleanup(), Eigen::TensorEvaluator< ArgType, Device >.cleanup(), Eigen::TensorEvaluator< ElseArgType, Device >.cleanup(), Eigen::TensorEvaluator< RightArgType, Device >.cleanup(), Eigen::TensorEvaluator< EvalLeftArgType, Device >.cleanup(), Eigen::TensorEvaluator< Arg3Type, Device >.cleanup(), Eigen::TensorEvaluator< Expr, Device >.cleanup(), Eigen::TensorEvaluator< ThenArgType, Device >.cleanup(), Eigen::TensorEvaluator< EvalRightArgType, Device >.cleanup(), Eigen::TensorEvaluator< IfArgType, Device >.cleanup(), Eigen::TensorEvaluator< InputArgType, Eigen::SyclDevice >.cleanup(), Eigen::TensorEvaluator< KernelArgType, Eigen::SyclDevice >.cleanup(), Eigen::TensorEvaluator< const Eigen::TensorReductionOp< ReduceOp, Dims, const Eigen::TensorIndexPairOp< ArgType > >, Device >.cleanup(), Eigen::TensorEvaluator< KernelArgType, Device >.cleanup(), Eigen::TensorEvaluator< LeftArgType, Device >.cleanup(), Eigen::TensorEvaluator< const Eigen::TensorIndexPairOp< ArgType >, Device >.cleanup(), Eigen::TensorEvaluator< Arg2Type, Device >.cleanup(), Eigen::TensorEvaluator< Arg1Type, Device >.cleanup(), Eigen::TensorEvaluator< const Derived, Device >.cleanup(), Eigen::TensorEvaluator< const TensorCwiseNullaryOp< NullaryOp, ArgType >, Device >.cleanup(), Eigen::TensorEvaluator< const TensorCwiseUnaryOp< UnaryOp, ArgType >, Device >.cleanup(), Eigen::TensorEvaluator< const TensorCwiseBinaryOp< BinaryOp, LeftArgType, RightArgType >, Device >.cleanup(), Eigen::TensorEvaluator< const TensorCwiseTernaryOp< TernaryOp, Arg1Type, Arg2Type, Arg3Type >, Device >.cleanup(), Eigen::TensorEvaluator< const TensorSelectOp< IfArgType, ThenArgType, ElseArgType >, Device >.cleanup(), Eigen::TensorEvaluator< const TensorFFTOp< FFT, ArgType, FFTResultType, FFTDir >, Device >.cleanup(), Eigen::TensorEvaluator< const TensorForcedEvalOp< ArgType_ >, Device >.cleanup(), Eigen::TensorEvaluator< const TensorGeneratorOp< Generator, ArgType >, Device >.cleanup(), Eigen::TensorEvaluator< const TensorImagePatchOp< Rows, Cols, ArgType >, Device >.cleanup(), Eigen::TensorEvaluator< const TensorInflationOp< Strides, ArgType >, Device >.cleanup(), Eigen::TensorEvaluator< const TensorLayoutSwapOp< ArgType >, Device >.cleanup(), Eigen::TensorEvaluator< const TensorReshapingOp< NewDimensions, ArgType >, Device >.cleanup(), Eigen::TensorEvaluator< const TensorSlicingOp< StartIndices, Sizes, ArgType >, Device >.cleanup(), Eigen::TensorEvaluator< const TensorStridingSlicingOp< StartIndices, StopIndices, Strides, ArgType >, Device >.cleanup(), Eigen::TensorEvaluator< const TensorPaddingOp< PaddingDimensions, ArgType >, Device >.cleanup(), Eigen::TensorEvaluator< const TensorPatchOp< PatchDim, ArgType >, Device >.cleanup(), Eigen::TensorReductionEvaluatorBase< const TensorReductionOp< Op, Dims, ArgType, MakePointer_ >, Device >.cleanup(), Eigen::TensorEvaluator< const TensorRef< Derived >, Device >.cleanup(), Eigen::TensorEvaluator< const TensorReverseOp< ReverseDimensions, ArgType >, Device >.cleanup(), Eigen::TensorEvaluator< const TensorRollOp< RollDimensions, ArgType >, Device >.cleanup(), Eigen::TensorEvaluator< const TensorScanOp< Op, ArgType >, Device >.cleanup(), Eigen::TensorEvaluator< const TensorShufflingOp< Shuffle, ArgType >, Device >.cleanup(), Eigen::TensorEvaluator< const TensorStridingOp< Strides, ArgType >, Device >.cleanup(), Eigen::TensorEvaluator< const TensorTraceOp< Dims, ArgType >, Device >.cleanup(), Eigen::TensorEvaluator< const TensorVolumePatchOp< Planes, Rows, Cols, ArgType >, Device >.cleanup(), framework.Frame.cleanup(), framework.Frame.detect_compilers(), if(), framework.Frame.look_for_mpibinaries(), framework.Frame.look_for_mpih(), framework.Frame.parse_args(), Eigen::internal.print(), framework.Frame.set_download(), framework.Frame.set_mangling(), and framework.Frame.set_ranlib().

Member Function Documentation

◆ cc_is_gnu()

def framework.Frame.cc_is_gnu (   self)
770  def cc_is_gnu(self):
771  comm = self.mpicc+' --help'
772  (output, error, retz) = runShellCommand(comm)
773  isifort = error.find('gnu.org')
774  if (isifort != -1):
775  return 1
776 
777  return 0
778 
779 
def runShellCommand(command)
Definition: utils.py:87

References framework.Frame.mpicc, and utils.runShellCommand().

Referenced by framework.Frame.detect_compilers().

◆ cc_is_intel()

def framework.Frame.cc_is_intel (   self)
760  def cc_is_intel(self):
761  comm = self.mpicc+' -V'
762  (output, error, retz) = runShellCommand(comm)
763  isifort = error.find('Intel(R) C Compiler')
764  if (isifort != -1):
765  return 1
766 
767  return 0
768 
769 

References framework.Frame.mpicc, and utils.runShellCommand().

Referenced by framework.Frame.detect_compilers().

◆ cc_is_pgi()

def framework.Frame.cc_is_pgi (   self)
780  def cc_is_pgi(self):
781  comm = self.mpicc+' -V'
782  (output, error, retz) = runShellCommand(comm)
783  isifort = error.find('pgicc')
784  if (isifort != -1):
785  return 1
786  isifort = error.find('Portland')
787  if (isifort != -1):
788  return 1
789  isifort = output.find('pgicc')
790  if (isifort != -1):
791  return 1
792  isifort = output.find('Portland')
793  if (isifort != -1):
794  return 1
795 
796  return 0
797 
798 

References framework.Frame.mpicc, and utils.runShellCommand().

Referenced by framework.Frame.detect_compilers().

◆ check_linking()

def framework.Frame.check_linking (   self)
 Check if C main can be linked to F77 subroutine 
502  def check_linking(self):
503  """ Check if C main can be linked to F77 subroutine """
504 
505  # This one checks if the linking command works out of the box or
506  # if any specific flag is required. For example if the linker if the
507  # Intel FORTRAN compiler, then the "-nofor_main" is usually required.
508  # This function only checks if linker works but does not automatically
509  # detect the required flags
510  print('Checking loader...', end=' ')
511  sys.stdout.flush()
512  writefile('tmpf.f',"""
513  subroutine fsub()
514  write(*,*)'success'
515  stop
516  end\n""")
517  writefile('tmpc.c',"""
518  #if defined Add_
519  #define fsub fsub_
520  #elif defined NoChange
521  #define fsub fsub
522  #elif defined f77IsF2C
523  #define fsub fsub_
524  #elif defined UpCase
525  #define fsub FSUB
526  #endif
527  void main(){
528  fsub();}\n""")
529 
530  ccomm = Frame.mpicc+' '+Frame.ccflags+' '+str(Frame.mangling)+' -c -o tmpc.o tmpc.c'
531  fcomm = Frame.mpif77+' '+Frame.fcflags+' -c -o tmpf.o tmpf.f'
532  lcomm = Frame.mpif77+' '+Frame.ldflags_c+' -o lnk tmpf.o tmpc.o'
533  (output, error, retz) = runShellCommand(ccomm)
534  if(retz != 0):
535  print('\n\nCOMMON: in check_linking: cannot compile')
536  print('command is: ',ccomm)
537  print('error is:\n','*'*40,'\n',error,'\n','*'*40)
538  sys.exit()
539 
540  (output, error, retz) = runShellCommand(fcomm)
541  if(retz != 0):
542  print('\n\nCOMMON: in check_linking: cannot compile')
543  print('command is: ',fcomm)
544  print('error is:\n','*'*40,'\n',error,'\n','*'*40)
545  sys.exit()
546 
547  (output, error, retz) = runShellCommand(lcomm)
548  if(retz != 0):
549  print("""\n\nCOMMON: in check_linking: cannot link
550  Cannot link a C main program to a Fortran77 subroutine
551  Make sure that the appropriate flags are passed to the linker.""")
552  print('command is: ',lcomm)
553  print('error is:\n','*'*40,'\n',error,'\n','*'*40)
554  sys.exit()
555 
556 
557  killfiles(['lnk', 'tmpf.f', 'tmpf.o', 'tmpc.c', 'tmpc.o'])
558 
559  print('works')
560  return 1;
561 
562 
563 
str
Definition: compute_granudrum_aor.py:141
def killfiles(lst)
Definition: utils.py:23
def writefile(fname, fill)
Definition: utils.py:17

References if(), utils.killfiles(), Eigen::internal.print(), utils.runShellCommand(), compute_granudrum_aor.str, and utils.writefile().

Referenced by framework.Frame.__init__().

◆ check_mpicc()

def framework.Frame.check_mpicc (   self)
 checks if mpicc works 
360  def check_mpicc(self):
361  """ checks if mpicc works """
362  # simply generates a C program containing a couple of calls
363  # to MPI routines and checks if the compilation and execution
364  # are succesful
365  print('Checking if mpicc works...', end=' ')
366  sys.stdout.flush()
367  # generate
368  writefile('tmpc.c',"""
369  #include \"mpi.h\"
370  #include <stdio.h>
371  int main(int argc, char **argv){
372  int iam;
373  MPI_Init( &argc, &argv );
374  MPI_Comm_rank( MPI_COMM_WORLD, &iam );
375  if(iam==0){fprintf(stdout, \"success\" );fflush(stdout);}
376  MPI_Finalize();
377  return 0;
378  }\n""")
379 
380  # compile
381  ccomm = Frame.mpicc+' -o tmpc '+os.path.join(os.getcwd(),'tmpc.c')
382  (output, error, retz) = runShellCommand(ccomm)
383 
384  if(retz != 0):
385  print('\n\nCOMMON: mpicc not working! aborting... retz = ',retz)
386  print('stderr:\n','*'*40,'\n',error,'\n','*'*40)
387  sys.exit()
388 
389 
390 
391  # run
392  comm = 'date'
393  print("before runShellcommand for date for mpicc")
394  (output, error, retz) = runShellCommand(comm)
395  if(retz != 0):
396  print('\n\nCOMMON: mpicc not working! aborting...')
397  print('error is:\n','*'*40,'\n',error,'\n','*'*40)
398  sys.exit()
399 
400  # cleanup
401  killfiles(['tmpc.c','tmpc'])
402  print('yes')
403 
404  return 0;
405 
406 
407 

References if(), utils.killfiles(), Eigen::internal.print(), utils.runShellCommand(), and utils.writefile().

Referenced by framework.Frame.__init__().

◆ check_mpif77()

def framework.Frame.check_mpif77 (   self)
 check if mpif77 works 
408  def check_mpif77(self):
409  """ check if mpif77 works """
410  # simply generates a F77 program containing a couple of calls
411  # to MPI routines and checks if the compilation and execution
412  # are succesful
413  print('Checking if mpif77 works...', end=' ')
414  sys.stdout.flush()
415  # generate
416  writefile('tmpf.f',"""
417  program ftest
418  include 'mpif.h'
419  integer Iam, i, ierr
420  call mpi_init(ierr)
421  call mpi_comm_rank(MPI_COMM_WORLD, Iam, ierr)
422  if (Iam .eq. 0) then
423  print*,'success'
424  end if
425  call mpi_finalize(ierr)
426  stop
427  end\n""")
428 
429  # compile
430  fcomm = Frame.mpif77+' -o tmpf '+'tmpf.f'
431  (output, error, retz) = runShellCommand(fcomm)
432 
433  if(retz != 0):
434  print('\n\nCOMMON: mpif77 not working! aborting...')
435  print('error is:\n','*'*40,'\n',error,'\n','*'*40)
436  sys.exit()
437 
438  # run
439  comm = 'date'
440  (output, error, retz) = runShellCommand(comm)
441  if(retz != 0):
442  print('\n\nCOMMON: mpif77 not working! aborting...')
443  print('error is:\n','*'*40,'\n',error,'\n','*'*40)
444  sys.exit()
445 
446  # cleanup
447  killfiles(['tmpf.f','tmpf','tmpf.o'])
448  print('yes')
449 
450  return 0;
451 
452 

References if(), utils.killfiles(), Eigen::internal.print(), utils.runShellCommand(), and utils.writefile().

Referenced by framework.Frame.__init__().

◆ cleanup()

def framework.Frame.cleanup (   self)
 Cleans up the installer directory 
831  def cleanup(self):
832  """ Cleans up the installer directory """
833 
834  print("Cleaning up...", end=' ')
835  sys.stdout.flush()
836 
837  cwd = os.getcwd()
838  builddir = os.path.join(cwd,'build')
839  libdir = os.path.join(cwd,'lib')
840  logdir = os.path.join(cwd,'log')
841 
842  comm = 'rm -rf '+builddir+' '+libdir+' '+logdir
843  (output, error, retz) = runShellCommand(comm)
844 
845  print("done.")

References Eigen::internal.print(), and utils.runShellCommand().

Referenced by framework.Frame.__init__().

◆ detect_compilers()

def framework.Frame.detect_compilers (   self)
 Tries to detect the compilers type 
665  def detect_compilers(self):
666  """ Tries to detect the compilers type """
667  # By users experience it is known which compiler flags are required
668  # in some cases. This function tries to detect which compilers are used
669  # and sets the flags accordingly
670 
671  print('Detecting Fortran compiler...', end=' ')
672  if (self.fc_is_intel()):
673  # The Intel FORTRAN compiler requires -nofor_main flag
674  # for the linking and the -mp flag to maintain the
675  # floating-point precision
676  Frame.ldflags_c += ' -nofor_main'
677  Frame.ldflags_f77 += ''
678  Frame.noopt += ' -mp'
679  print('Intel')
680  elif (self.fc_is_gnu()):
681  print('GNU')
682  elif (self.fc_is_pgi()):
683  Frame.ldflags_c += ' -Mnomain'
684  Frame.ldflags_f77 += ''
685  else:
686  print('unknown')
687 
688 
689  print('Detecting C compiler...', end=' ')
690  if (self.cc_is_intel()):
691  print('Intel')
692  elif (self.cc_is_gnu()):
693  print('GNU')
694  elif (self.cc_is_pgi()):
695  print('PGI')
696  else:
697  print('unknown')
698 
699 
700  print('Selected C compiler flags: '+self.ccflags)
701  print('Selected Fortran77 compiler flags: '+self.fcflags)
702  print('Selected loader flags (C main): '+self.ldflags_c)
703  print('Selected loader flags (F77 main): '+self.ldflags_f77)
704  print('Selected NOOPT flags: '+self.noopt)
705 
706  return
707 
708 

References framework.Frame.cc_is_gnu(), framework.Frame.cc_is_intel(), framework.Frame.cc_is_pgi(), framework.Frame.ccflags, framework.Frame.fc_is_gnu(), framework.Frame.fc_is_intel(), framework.Frame.fc_is_pgi(), framework.Frame.fcflags, framework.Frame.ldflags_c, framework.Frame.ldflags_f77, framework.Frame.noopt, and Eigen::internal.print().

Referenced by framework.Frame.__init__().

◆ fc_is_gnu()

def framework.Frame.fc_is_gnu (   self)
719  def fc_is_gnu(self):
720  comm = self.mpif77+' --help'
721  (output, error, retz) = runShellCommand(comm)
722  isifort = error.find('gnu.org')
723  if (isifort != -1):
724  return 1
725 
726  return 0
727 

References framework.Frame.mpif77, and utils.runShellCommand().

Referenced by framework.Frame.detect_compilers().

◆ fc_is_intel()

def framework.Frame.fc_is_intel (   self)
709  def fc_is_intel(self):
710  comm = self.mpif77+' -V'
711  (output, error, retz) = runShellCommand(comm)
712  isifort = error.find('Intel(R) Fortran Compiler')
713  if (isifort != -1):
714  return 1
715 
716  return 0
717 
718 

References framework.Frame.mpif77, and utils.runShellCommand().

Referenced by framework.Frame.detect_compilers().

◆ fc_is_pgi()

def framework.Frame.fc_is_pgi (   self)
728  def fc_is_pgi(self):
729  comm = self.mpif77+' -V'
730  (output, error, retz) = runShellCommand(comm)
731  isifort = error.find('pgif77')
732  if (isifort != -1):
733  return 1
734  isifort = error.find('pgif90')
735  if (isifort != -1):
736  return 1
737  isifort = error.find('pgif95')
738  if (isifort != -1):
739  return 1
740  isifort = error.find('Portland')
741  if (isifort != -1):
742  return 1
743  isifort = output.find('pgif77')
744  if (isifort != -1):
745  return 1
746  isifort = output.find('pgif90')
747  if (isifort != -1):
748  return 1
749  isifort = output.find('pgif95')
750  if (isifort != -1):
751  return 1
752  isifort = output.find('Portland')
753  if (isifort != -1):
754  return 1
755 
756  return 0
757 
758 
759 

References framework.Frame.mpif77, and utils.runShellCommand().

Referenced by framework.Frame.detect_compilers().

◆ look_for_mpibinaries()

def framework.Frame.look_for_mpibinaries (   self)
 looks for MPI compilers in mpibindir or in PATH 
290  def look_for_mpibinaries(self):
291  """ looks for MPI compilers in mpibindir or in PATH """
292  # This function is only able to find mpicc/mpif77. If the name of the
293  # compilers are different (like mpixlc or mpixlf) the user must explicitly provide them
294  # with the related flags
295  if(Frame.mpibindir != ''):
296  # look for mpicc and mpif77 in mpibindir
297  if(os.path.isfile(os.path.join(Frame.mpibindir,'mpicc'))):
298  Frame.mpicc = os.path.join(Frame.mpibindir,'mpicc')
299  print('mpicc :',Frame.mpicc)
300  else:
301  print('Could not find mpicc in ', Frame.mpibindir)
302  if(os.path.isfile(os.path.join(Frame.mpibindir,'mpif77'))):
303  Frame.mpif77 = os.path.join(Frame.mpibindir,'mpif77')
304  print('mpif77 :',Frame.mpif77)
305  else:
306  print('Could not find mpif77 in ',Frame.mpibindir)
307 
308  # is mpicc and mpif77 haven't been found
309  if(Frame.mpicc=='' and Frame.mpif77==''):
310 
311  path=str(os.getenv('PATH')).split(os.pathsep)
312  print('Looking for MPI binaries...', end=' ')
313  sys.stdout.flush()
314  for i in path:
315  mpicc = os.path.join(i,'mpicc')
316  mpif77 = os.path.join(i,'mpif77')
317  if (Frame.mpicc == '' and os.path.isfile(mpicc)):
318  Frame.mpicc = mpicc
319  if (Frame.mpif77 == '' and os.path.isfile(mpif77)):
320  Frame.mpif77 = mpif77
321  if (Frame.mpicc!='' or Frame.mpif77!=''):
322  print("mpicc and mpif77 found.\nmpicc : "+Frame.mpicc+"\nmpif77 :"+Frame.mpif77)
323  return 1;
324 
325  elif (Frame.mpicc=='' or Frame.mpif77==''):
326  print("""
327 The information about the location of MPI commands is incomplete.
328 Please, either provide the path to the directory containing mpicc
329 and mpif77 with the --mpibindir flag or the full path to both
330 commands with the --mpicc AND --mpif77 flags. In case none of these
331 flags are provided, the installer will look for mpicc and mpif77
332 in the PATH environment variable.
333 """)
334  return 0;
335 
336  return 1;
337 
338 
339 
340 
void split(const DoubleVector &in_vector, Vector< DoubleVector * > &out_vector_pt)
Definition: double_vector.cc:1413

References if(), Eigen::internal.print(), oomph::DoubleVectorHelpers.split(), and compute_granudrum_aor.str.

Referenced by framework.Frame.__init__().

◆ look_for_mpih()

def framework.Frame.look_for_mpih (   self)
 looks for mpi.h close to mpibindir 
341  def look_for_mpih(self):
342  """ looks for mpi.h close to mpibindir """
343  import re
344 
345  print('Looking for mpi.h...', end=' ')
346  for i in [Frame.mpibindir[0:Frame.mpibindir.find('bin')], Frame.mpicc[0:Frame.mpicc.find('bin')], Frame.mpif77[0:Frame.mpif77.find('bin')]]:
347  sys.stdout.flush()
348  tmp = i+'include'
349  if(os.path.isfile(os.path.join(tmp,'mpi.h'))):
350  Frame.mpiincdir = tmp
351  print('found in '+i+'include')
352  return 1;
353 
354  print('not found')
355 
356  return 0;
357 
358 
359 

References if(), and Eigen::internal.print().

Referenced by framework.Frame.__init__().

◆ parse_args()

def framework.Frame.parse_args (   self,
  argv 
)
 Parse input argument to get compilers etc. from command line. 
215  def parse_args(self, argv):
216  """ Parse input argument to get compilers etc. from command line. """
217 
218  try:
219  opts, args = getopt.getopt(sys.argv[1:], "h", ["help","prefix=",
220  "ccflags=", "fcflags=", "noopt=", "makecmd=", "mpibindir=", "mpiincdir=", "blacslib=",
221  "blacsclib=", "blacsf77lib=", "blaslib=", "lapacklib=", "ldflags_c=", "ldflags_f77=","mpicc=","mpif77=",
222  "downblas", "downblacs", "downlapack", "notesting","clean"])
223  except getopt.error as msg:
224  print(msg)
225  print("for help use --help")
226  sys.exit(2)
227  # process options
228  for o, a in opts:
229  if o in ("-h", "--help"):
230  self.usage()
231  sys.exit(0)
232  else:
233  if(o == '--clean'):
234  Frame.clean = 1
235  return;
236  elif(o == '--prefix'):
237  Frame.prefix = fixpaths(a)
238  print('Install directory is...', Frame.prefix)
239  elif(o == '--ccflags'):
240  Frame.ccflags = a
241  print('C flags are ', a)
242  elif(o=='--fcflags'):
243  Frame.fcflags = a
244  print('Fortran flags are ', a)
245  elif(o=='--noopt'):
246  Frame.noopt = a
247  print('NOOPT flags are ', a)
248  elif(o=='--makecmd'):
249  Frame.make = a
250  elif(o=='--mpibindir'):
251  Frame.mpibindir = fixpaths(a)
252  print('MPI bin dir is ', Frame.mpibindir)
253  elif(o=='--mpiincdir'):
254  Frame.mpiincdir = fixpaths(a)
255  print('MPI include dir is ', Frame.mpiincdir)
256  elif(o=='--mpicc'):
257  Frame.mpicc = a
258  print('mpicc is ', a)
259  elif(o=='--mpif77'):
260  Frame.mpif77 = a
261  print('mpif77 is ', a)
262  elif(o == '--blacslib'):
263  Frame.blacslib = fixpaths(a)
264  Frame.downblacs = 0
265  elif(o == '--blacsclib'):
266  Frame.blacsClib = fixpaths(a)
267  Frame.downblacs = 0
268  elif(o == '--blacsf77lib'):
269  Frame.blacsF77lib = fixpaths(a)
270  Frame.downblacs = 0
271  elif (o == '--blaslib'):
272  Frame.blaslib = fixpaths(a)
273  elif (o == '--lapacklib'):
274  Frame.lapacklib = fixpaths(a)
275  elif (o == '--downblas'):
276  Frame.downblas = 1
277  elif (o == '--downblacs'):
278  Frame.downblacs = 1
279  elif (o == '--downlapack'):
280  Frame.downlapack = 1
281  elif (o == '--notesting'):
282  Frame.testing = 0
283  elif (o == '--ldflags_c'):
284  Frame.ldflags_c = a
285  elif (o == '--ldflags_f77'):
286  Frame.ldflags_f77 = a
287 
288 
def fixpaths(inpath)
Definition: utils.py:195

References utils.fixpaths(), if(), Eigen::internal.print(), tetgenbehavior.usage(), and framework.Frame.usage().

Referenced by framework.Frame.__init__().

◆ resume()

def framework.Frame.resume (   self)
799  def resume(self):
800 
801  cwd = os.getcwd()
802  print("""
803 ******************************************************
804 ******************************************************
805 
806 ScaLAPACK installation completed.
807 
808 
809 Your BLAS library is:\n"""+self.blaslib+"""
810 \nYour BLACS libraries are:\n"""+self.blacslib+'\n'+self.blacsClib+'\n'+self.blacsF77lib+"""
811 \nYour LAPACK library is:\n"""+self.lapacklib+"""\n
812 Your ScaLAPACK library is:\n"""+self.scalapacklib+"""
813 
814 Log messages are in the\n"""+os.path.join(cwd,'log')+"""
815 directory.
816 
817 The Scalapack testing programs are in:\n"""+os.path.join(cwd,'build/scalapack-1.8.0/TESTING')+"""
818 
819 
820 The\n"""+os.path.join(cwd,'build')+"""
821 directory contains the source code of the libraries
822 that have been installed. It can be removed at this time.
823 
824 
825 ******************************************************
826 ******************************************************
827 """)
828 
829 
830 

References blacs.Blacs.blacsClib, framework.Frame.blacsClib, blacs.Blacs.blacsF77lib, framework.Frame.blacsF77lib, blacs.Blacs.blacslib, framework.Frame.blacslib, blas.Blas.blaslib, framework.Frame.blaslib, framework.Frame.lapacklib, lapack.Lapack.lapacklib, Eigen::internal.print(), framework.Frame.scalapacklib, and scalapack.Scalapack.scalapacklib.

◆ set_download()

def framework.Frame.set_download (   self)
 Figures out how to download files 
564  def set_download(self):
565  """ Figures out how to download files """
566  print('Setting download command...')
567  wget = 0
568  urllib = 0
569  # look for proxy setting in the environnement variables
570  proxy_http=str(os.getenv('http_proxy'))
571  # if proxy_http found in the environnement, we are going to use wget as download command
572  if (proxy_http != 'None'):
573  Frame.proxy=1
574  urllib=0
575  else:
576  try:
577  # check if the urllib2 module is included in the
578  # python installation. If yes files are downloaded with urllib2
579  print("Checking availability of urllib...", end=' ')
580  import urllib.request, urllib.error, urllib.parse
581  urllib=1
582  print("available")
583  print("Testing urllib...", end=' ')
584  try:
585 # name = getURLName('http://www.netlib.org/lapack/index')
586  url = urllib.request.urlopen('http://www.netlib.org/lapack/index')
587  f = open(name,'w')
588  for line in url.readlines():
589  f.write(line)
590  url.close()
591  f.close()
592  except:
593  print("not working")
594  urllib = -1
595  else:
596  print("working")
597  Frame.downcmd = 'urllib2'
598  os.remove('index')
599  return
600  except ImportError:
601  print("not available")
602  urllib=0
603 
604  if(urllib <= 0):
605  # if urllib2 is not present checks if wget is present
606  # in the PATH and if yes it sets the download command
607  # to be wget
608  print("Checking availablility of wget...", end=' ')
609  path=str(os.getenv('PATH')).split(os.pathsep)
610  for i in path:
611  if (os.path.isfile(os.path.join(i,'wget'))):
612  print("available")
613  wget = 1
614  break
615 
616  if(wget == 1):
617  # test wget
618  if (proxy_http != 'None'):
619  print("Testing wget through the "+proxy_http+" proxy...", end=' ')
620  else:
621  print("Testing wget...", end=' ')
622  try:
623  comm = 'wget http://www.netlib.org/lapack/index'
624  (output, error, retz) = runShellCommand(comm)
625  if(retz != 0):
626  raise
627  except:
628  print('not working.')
629  wget = -1
630  else:
631  print('working')
632  Frame.downcmd='wget'
633  os.remove('index')
634  return
635  else:
636  # wget not available
637  print("not available")
638  wget=0
639 
640 

References if(), Eigen::internal.print(), utils.runShellCommand(), oomph::DoubleVectorHelpers.split(), and compute_granudrum_aor.str.

Referenced by framework.Frame.__init__().

◆ set_mangling()

def framework.Frame.set_mangling (   self)
 Sets the INTFACE variable in Bmake.inc 
453  def set_mangling(self):
454  """ Sets the INTFACE variable in Bmake.inc """
455  # This one generates a program equivalent to that in BLACS/INSTALL
456  # that checks the mangling in FORTRAN function symbols
457  print ('Setting Fortran Mangling...'),
458  sys.stdout.flush()
459  writefile('tmpf.f',"""
460  program intface
461  external c_intface
462  integer i
463  call c_intface(i)
464  stop
465  end\n""")
466  writefile('tmpc.c',"""
467  #include <stdio.h>
468  void c_intface_(int *i){fprintf(stdout, \"-DAdd_\");fflush(stdout);}
469  void c_intface(int *i){fprintf(stdout, \"-DNoChange\");fflush(stdout);}
470  void c_intface__(int *i){fprintf(stdout, \"-Df77IsF2C\");fflush(stdout);}
471  void C_INTFACE(int *i){fprintf(stdout, \"-DUpCase\");fflush(stdout);}\n""")
472 
473  ccomm = Frame.mpicc+' '+Frame.ccflags+' -c tmpc.c -o tmpc.o'
474  fcomm = Frame.mpif77+' '+Frame.fcflags+' tmpf.f tmpc.o -o xintface'
475 
476  (output, error, retz) = runShellCommand(ccomm)
477  if(retz != 0):
478  print('\n\nCOMMON: in set_mangling: cannot compile')
479  print('error is:\n','*'*40,'\n',error,'\n','*'*40)
480  sys.exit()
481 
482  (output, error, retz) = runShellCommand(fcomm)
483  if(retz != 0):
484  print('\n\nCOMMON: in set_mangling: cannot compile')
485  print('error is:\n','*'*40,'\n',error,'\n','*'*40)
486  sys.exit()
487 
488  comm = os.path.join(os.getcwd(),'xintface')
489  (output, error, retz) = runShellCommand(comm)
490  if(retz != 0):
491  print('\n\nCOMMON: in set_mangling: cannot run xintface')
492  print('error is:\n','*'*40,'\n',error,'\n','*'*40)
493  sys.exit()
494 
495  Frame.mangling = str(output)
496  killfiles(['xintface', 'tmpf.f', 'tmpf.o', 'tmpc.c', 'tmpc.o'])
497 
498  print("mangling: ",Frame.mangling)
499  return 1;
500 
501 

References if(), utils.killfiles(), Eigen::internal.print(), utils.runShellCommand(), compute_granudrum_aor.str, and utils.writefile().

Referenced by framework.Frame.__init__().

◆ set_ranlib()

def framework.Frame.set_ranlib (   self)
 Sets the ranlib command 
641  def set_ranlib(self):
642  """ Sets the ranlib command """
643  # Some systems don't have the ranlib command (e.g. SGIs).
644  # In the case where ranlib is not present in the PATH,
645  # echo is used instead of ranlib
646  print("Setting ranlib command...", end=' ')
647 
648  path=str(os.getenv('PATH')).split(os.pathsep)
649  for i in path:
650  if (os.path.isfile(os.path.join(i,'ranlib'))):
651  Frame.ranlib=os.path.join(i,'ranlib')
652  print(Frame.ranlib)
653  return
654 
655  for i in path:
656  if (os.path.isfile(os.path.join(i,'echo'))):
657  Frame.ranlib=os.path.join(i,'echo')
658  print(Frame.ranlib)
659  return
660 
661 
662 
663 
664 

References Eigen::internal.print(), oomph::DoubleVectorHelpers.split(), and compute_granudrum_aor.str.

Referenced by framework.Frame.__init__().

◆ usage()

def framework.Frame.usage (   self)
127  def usage(self):
128  print('='*40)
129  print("""
130  ScaLAPACK configuration script
131  The script will try to figure out some of the features of your system
132  like the mpi compiler and the location of few other tools required for
133  the installation of the ScaLAPACK package and the other software
134  packages that it requires.
135  It is strongly recommended that you help the script by providing info
136  through the flags listed below
137 
138 
139  -h or --help : prints this message
140 
141  --prefix : path where to create the libraries, build and log of the installer
142 
143  --mpibindir=[DIR] : the path to where the mpi
144  binaries (mpicc and mpif77)
145  are contained
146 
147  --mpicc=[CMD] : the mpicc command.
148  (default: will take the first available mpicc in the path)
149 
150  --mpif77=[CMD] : the mpif77 command.
151  (default: will take the first available mpif77 in the path)
152 
153  --mpiincdir=[DIR] : the path to the directory containing mpi.h
154  (default: will take the corresponding mpi.h to the mpicc/mpif77 found)
155 
156  --ccflags=[FLAGS] : the flags for the C compiler
157  (default -O3)
158 
159  --fcflags=[FLAGS] : the flags for the F77 compiler
160  (default -O3)
161 
162  --noopt=[FLAGS] : compilation flags to be used
163  on machine dependent subroutines
164  in LAPACK and ScaLAPACK.
165  See LAPACK and ScaLAPACK documentation.
166 
167  --ldflags_c=[flags] : loader flags when main program is in C. Some compilers (e.g. PGI) require
168  different options when linking C main programs to Fortran subroutines
169  and vice-versa
170 
171  --ldflags_f77=[flags]: loader flags when main program is in Fortran. Some compilers (e.g. PGI) require
172  different options when linking Fortran main programs to C subroutines
173  and vice-versa
174 
175  --makecmd=[CMD] : the make command
176  (make by default)
177 
178  --blacslib=[LIB] : the BLACS library
179  (path should be absolute if --prefix is used)
180 
181  --blacsclib=[LIB] : the BLACS C interface library
182  (path should be absolute if --prefix is used)
183 
184  --blacsf77lib=[LIB] : the BLACS F77 interface library
185  (path should be absolute if --prefix is used)
186 
187  --blaslib=[LIB] : a BLAS library
188  (path should be absolute if --prefix is used)
189 
190  --lapacklib=[LIB] : a LAPACK library
191  (path should be absolute if --prefix is used)
192 
193  --downblas : if you do not want to provide a BLAS
194  we can download and install it for you
195 
196  --downblacs : if you do not want to provide a BLACS
197  we can download and install it for you
198 
199  --downlapack : if you do not want to provide a LAPACK
200  we can download and install it for you
201 
202  --notesting : disables the ScaLAPACK testing. The
203  BLAS, BLACS and LAPACK libraries are not
204  required in this case.
205 
206  --clean : cleans up the installer directory.
207 
208 Note: If you want use a proxy for downloading, the http_proxy environment variable has to be set.
209  """)
210  print('='*40)
211  sys.exit()
212 
213 
214 
string usage
Definition: fpsmall.py:6

References Eigen::internal.print().

Referenced by framework.Frame.parse_args().

Member Data Documentation

◆ blacsClib

string framework.Frame.blacsClib = ''
static

◆ blacsF77lib

string framework.Frame.blacsF77lib = ''
static

◆ blacslib

◆ blacsurl

string framework.Frame.blacsurl = 'http://netlib.org/blacs/mpiblacs.tgz'
static

◆ blaslib

◆ blasurl

string framework.Frame.blasurl = 'http://netlib.org/blas/blas.tgz'
static

◆ ccflags

◆ clean

int framework.Frame.clean = 0
static

◆ downblacs

int framework.Frame.downblacs = 1
static

Referenced by blacs.Blacs.__init__().

◆ downblas

int framework.Frame.downblas = 0
static

Referenced by blas.Blas.__init__().

◆ downcmd

◆ downlapack

int framework.Frame.downlapack = 0
static

Referenced by lapack.Lapack.__init__().

◆ fcflags

◆ lapacklib

◆ lapackurl

string framework.Frame.lapackurl = 'http://netlib.org/lapack/lapack.tgz'
static

◆ ldflags_c

string framework.Frame.ldflags_c = ''
static

◆ ldflags_f77

◆ make

string framework.Frame.make = 'make'
static

◆ mangling

string framework.Frame.mangling = ''
static

◆ mpibindir

string framework.Frame.mpibindir = ''
static

◆ mpicc

◆ mpif77

◆ mpiincdir

string framework.Frame.mpiincdir = ''
static

Referenced by blacs.Blacs.write_bmake().

◆ noopt

◆ plat

string framework.Frame.plat = 'LINUX'
static

◆ prefix

string framework.Frame.prefix = ''
static

◆ proxy

int framework.Frame.proxy = 0
static

◆ ranlib

string framework.Frame.ranlib = ''
static

◆ scalapacklib

string framework.Frame.scalapacklib = ''
static

Referenced by framework.Frame.resume().

◆ scalapackurl

string framework.Frame.scalapackurl = 'http://netlib.org/scalapack/scalapack-1.8.0.tgz'
static

◆ testing

int framework.Frame.testing = 1
static

The documentation for this class was generated from the following file: