def runtime(self, _from='0'):
        """Generate the set of instructions to install the runtime specific
        components from a build in a previous stage.

        # Examples

        ```python
        n = nvhpc(redist=[...], ...)
        Stage0 += n
        Stage1 += n.runtime()
        ```
        """
        if self.__redist:
            self.rt += comment('NVIDIA HPC SDK')

            if self.__runtime_ospackages:
                self.rt += packages(ospackages=self.__runtime_ospackages)

            redistpath = posixpath.join(self.__prefix,
                                        self.__arch_directory,
                                        self.__version, 'REDIST')

            libdirs = {}

            for r in self.__redist:
                src = posixpath.join(redistpath, r)

                if '*' in posixpath.basename(r):
                    # When using COPY with more than one source file,
                    # the destination must be a directory and end with
                    # a /
                    dest = posixpath.join(posixpath.dirname(redistpath),
                                          posixpath.dirname(r)) + '/'
                else:
                    dest = posixpath.join(posixpath.dirname(redistpath), r)

                self.rt += copy(_from=_from, src=src, dest=dest)

                # If the redist path looks like a library directory,
                # add it to LD_LIBRARY_PATH
                if '/lib' in posixpath.dirname(r):
                    libdirs[posixpath.join(posixpath.dirname(redistpath),
                                           posixpath.dirname(r))] = True

            if self.__redist and self.__mpi:
                mpipath = posixpath.join(self.__basepath, 'comm_libs', 'mpi')
                self.rt += copy(_from=_from, src=mpipath, dest=mpipath)
                libdirs[posixpath.join(mpipath, 'lib')] = True
                self.runtime_environment_variables['PATH'] = '{}:$PATH'.format(
                    posixpath.join(mpipath, 'bin'))

            if libdirs:
                liblist = sorted(libdirs.keys())
                liblist.append('$LD_LIBRARY_PATH')
                
                self.runtime_environment_variables['LD_LIBRARY_PATH'] = ':'.join(liblist)
                self.rt += environment(
                    variables=self.runtime_environment_variables)

        return str(self.rt)
Generate the set of instructions to install the runtime specific
        components from a build in a previous stage.

        # Examples

        ```python
        n = nvhpc(redist=[...], ...)
        Stage0 += n
        Stage1 += n.runtime()
        ```
        
hpccm/building_blocks/nvhpc.py