⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 set_environment.bat

📁 famous linear algebra library (LAPACK) ports to windows
💻 BAT
字号:
@echo off

REM 
REM set_environment.bat:
REM Setup development environment to build LAPACK based on provided
REM command-line arguments. 
REM
REM LAPACK, Version 3.1.1
REM June 2007

REM Display help if user requests it.
if "%~1" == "/?" goto USAGE

REM Get machine architecture.
set MACHINE_ARCH="%~1"

REM Get compiler name.
set COMPILER_NAME="%~2"

REM Get absolute path of the BLAS library.
set BLASLIB_ABSPATH="%~f3"

REM Get the BLAS library extension.
set BLASLIB_EXT="%~x3"

REM Get the name of the BLAS Library.
REM In case of IMKL, this will be used to link the dependent libraries.
set BLASLIB_NAME="%~n3"

REM Get the path to BLAS library.
REM This will be used add library/dll directory in PATH environment variable.
set BLASLIB_PATH=%~dp3

REM
REM Machine architecture is mandatory. If user doesn't provide one, 
REM display usage.
REM 
if %MACHINE_ARCH% == ""	goto USAGE

if %MACHINE_ARCH% == "x86" (
    set MACHINE_ARCH_64=
) else (
    if %MACHINE_ARCH% == "x64" (
    set MACHINE_ARCH_64=1
   )	else	goto USAGE
)

REM
REM Compiler name is mandatory. If user doesn't provide one, display usage.
REM 
if %COMPILER_NAME% == "" goto USAGE

REM
REM Valid options to choose Intel compiler.
REM 

if %COMPILER_NAME% == "Intel" (
    set COMPILER_NAME="INTEL"
    goto LIB_PATH_CHECK
)
if %COMPILER_NAME% == "intel" (
    set COMPILER_NAME="INTEL"
    goto LIB_PATH_CHECK
)
if %COMPILER_NAME% == "INTEL" goto LIB_PATH_CHECK

REM
REM Valid options to choose PGI compiler.
REM 

if %COMPILER_NAME% == "pgi" (
    set COMPILER_NAME="PGI"
    goto LIB_PATH_CHECK
)
if %COMPILER_NAME% == "PGI" goto LIB_PATH_CHECK

:USAGE
echo.
echo "Usage: set_environment.bat <x86 | x64> <Intel | PGI> [BLAS Library Path]"
REM If user requests help, exit with 0, otherwise exit with non-zero value.
if "%~1" == "/?"	exit /B 0
exit /B 1

:LIB_PATH_CHECK
REM
REM By default, it uses BLAS library shipped with the package.
REM 

if %BLASLIB_ABSPATH% == "" (
    REM Default Library needs to be built, hence set the flag.
    set BUILD_DEFAULT_BLASLIB=1
    if X%MACHINE_ARCH_64%==X1 (
        set BLASLIB_ABSPATH="%~dp0blas_WIN64.lib"
    ) else ( 
        set BLASLIB_ABSPATH="%~dp0blas_WIN32.lib"
    )
) else (
    REM
    REM External BLAS library is provided.
    REM Default BLAS library needs not to be built, hence unset the flag.
    set BUILD_DEFAULT_BLASLIB=
    REM Ensure that provided library has .lib extension.
    REM 
    if not X%BLASLIB_EXT% == X".lib"  (
        echo.
        echo Please specify a library name having .lib extension.
        echo Please enclose the library path in "double quotes" if it contains spaces.
        exit /B 1
    )
    REM
    REM Ensure that provided library exists.
    REM
    if not exist %BLASLIB_ABSPATH%	(
        echo.
        echo The specified BLAS library does not exist...please check the path.
        exit /B 1
    )
)

REM 
REM REM Display the development environment information
echo.
echo Setting up Development Environment...
echo.
echo Machine architecture being used: %MACHINE_ARCH%
echo.
echo Compiler being used: %COMPILER_NAME%
echo.
echo BLAS library being used: %BLASLIB_ABSPATH%
echo.

REM Set PATH variable to use given BLAS library and dependent dll libraries.
set PATH=%BLASLIB_PATH%;%BLASLIB_PATH%..\bin;%PATH%

if %COMPILER_NAME% == "PGI" goto PGI

:INTEL
REM Setting development environment for Intel compiler...
copy /Y make.inc.intel make.inc > nul

echo Note:
echo Please execute "nmake cleanall" command if you have built the package earlier in different environment.
echo.

REM Depending upon the Machine Architecture (32-bit/64-bit),
REM invoke Intel Compiler's respective batch script
if X%MACHINE_ARCH_64%==X1 (
    REM Additional 64-bit BLAS libraries need to be linked in case IMKL.
    if %BLASLIB_NAME% == "mkl_dll" (
        set BLASLIB_ABSPATH=%BLASLIB_ABSPATH% "%BLASLIB_PATH%libguide40.lib"
    ) else if %BLASLIB_NAME% == "mkl_em64t" (
        set BLASLIB_ABSPATH=%BLASLIB_ABSPATH% "%BLASLIB_PATH%libguide.lib"
    )
    call "%IFORT_COMPILER91%\em64t\Bin\ifortvars.bat"
) else (
    REM Additional 32-bit BLAS libraries need to be linked in case IMKL.
    if %BLASLIB_NAME% == "mkl_c_dll" (
        set BLASLIB_ABSPATH=%BLASLIB_ABSPATH% "%BLASLIB_PATH%libguide40.lib" "%BLASLIB_PATH%mkl_ia32.lib"
    ) else if %BLASLIB_NAME% == "mkl_c" (
        set BLASLIB_ABSPATH=%BLASLIB_ABSPATH% "%BLASLIB_PATH%libguide.lib" "%BLASLIB_PATH%mkl_ia32.lib" 
    )
    call "%IFORT_COMPILER91%\IA32\Bin\ifortVars.bat"
)
goto Done

:PGI
REM Setting development environment for PGI compiler...
copy /Y make.inc.pgi make.inc > nul

echo Note:
echo Please execute "nmake cleanall" command if you have built the package earlier in different environment.
echo.

REM Depending upon the Machine Architecture, (32-bit/64-bit),
REM invoke PGI Compiler's respective batch script
if X%MACHINE_ARCH_64%==X1 (
    call "%SYSTEMDRIVE%\Program Files\PGI\win64\7.0-3\pgi_dos.bat"
) else (
    call "%SYSTEMDRIVE%\Program Files (x86)\PGI\win32\7.0-3\pgi_dos.bat"
)
:Done

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -