def __configure(self):
        """Construct the series of shell commands, i.e., fill in
           self.__commands"""

        # MVAPICH2 does not accept F90
        self.__toolchain.F90 = ''

        # Workarounds when using the NV compilers
        if (self.__toolchain.CC and re.match('.*nvc', self.__toolchain.CC) and
            not self.__toolchain.CFLAGS):
            self.__toolchain.CFLAGS = '-fpic -DPIC'
            self.__configure_opts.append('ac_cv_c_compiler_gnu=no')
        if (self.__toolchain.F77 and
            re.match('.*nvfortran', self.__toolchain.F77) and
            not self.__toolchain.FFLAGS):
            self.__toolchain.FFLAGS = '-fpic -DPIC'
        if (self.__toolchain.FC and
            re.match('.*nvfortran', self.__toolchain.FC) and
            not self.__toolchain.FCFLAGS):
            self.__toolchain.FCFLAGS = '-fpic -DPIC'

        # CUDA
        if self.__cuda:
            cuda_home = "/usr/local/cuda"
            if self.__toolchain.CUDA_HOME:
                cuda_home = self.__toolchain.CUDA_HOME

            # The PGI compiler needs some special handling for CUDA.
            # http://mvapich.cse.ohio-state.edu/static/media/mvapich/mvapich2-2.0-userguide.html#x1-120004.5
            if self.__toolchain.CC and re.match('.*pgcc', self.__toolchain.CC):
                self.__configure_opts.append(
                    '--enable-cuda=basic --with-cuda={}'.format(cuda_home))

                # Work around issue when using PGI 19.4
                self.__configure_opts.append('--enable-fast=O1')

                if not self.__toolchain.CFLAGS:
                    self.__toolchain.CFLAGS = '-ta=tesla:nordc'

                if not self.__toolchain.CPPFLAGS:
                    self.__toolchain.CPPFLAGS = '-D__x86_64 -D__align__\(n\)=__attribute__\(\(aligned\(n\)\)\) -D__location__\(a\)=__annotate__\(a\) -DCUDARTAPI='

                if not self.__toolchain.LD_LIBRARY_PATH:
                    self.__toolchain.LD_LIBRARY_PATH = posixpath.join(
                        cuda_home, 'lib64', 'stubs') + ':$LD_LIBRARY_PATH'
            else:
                if not self.__toolchain.LD_LIBRARY_PATH:
                    self.__toolchain.LD_LIBRARY_PATH = posixpath.join(
                        cuda_home, 'lib64', 'stubs') + ':$LD_LIBRARY_PATH'
                self.__configure_opts.append(
                    '--enable-cuda --with-cuda={}'.format(cuda_home))

            # Workaround for using compiler wrappers in the build stage
            self.__preconfigure.append('ln -s {0} {1}'.format(
                posixpath.join(cuda_home, 'lib64', 'stubs', 'libnvidia-ml.so'),
                posixpath.join(cuda_home, 'lib64', 'stubs',
                               'libnvidia-ml.so.1')))
            self.__preconfigure.append('ln -s {0} {1}'.format(
                posixpath.join(cuda_home, 'lib64', 'stubs', 'libcuda.so'),
                posixpath.join(cuda_home, 'lib64', 'stubs', 'libcuda.so.1')))

            # Older versions of MVAPICH2 (2.3b and previous) were
            # hard-coded to use the "sm_20" GPU architecture.  Use the
            # specified value instead.
            if self.__gpu_arch:
                self.__preconfigure.append(
                    self.sed_step(file='Makefile.in',
                                  patterns=[r's/-arch sm_20/-arch {}/g'.format(self.__gpu_arch)]))

        else:
            self.__configure_opts.append('--disable-cuda')
Construct the series of shell commands, i.e., fill in
           self.__commands
hpccm/building_blocks/mvapich2.py