def release_primary_context(self):
        """
        Release reference to primary context if it has been retained.
        """
        if self.primary_context:
            driver.cuDevicePrimaryCtxRelease(self.id)
            self.primary_context = None

        Release reference to primary context if it has been retained.
        
numba/cuda/cudadrv/driver.py