Ubuntu 10.04下安装PGI Fortran 10.2 由于在linux下运行ecomsed,需要编译makefile,试过了ifort编译器,发现编译器和自己的能力都不给力,又试试FC=pgf90,发现原来安装的pgflinux.711的licen se.dat过期了,悲剧啊,尝试了两天,终于找到10.2版本还可用,功夫不负有心人啊! 第一步,先去官网下载编译器,直接去下载10.2版本,我从MU(http://www.mnmuc.org/thread-1104-1-1.html)上下载了一个64位PGI(10.2)编译器的license.dat 新建一个目录 mkdir pgilinux-10.2 cd pgilinux-10.2 然后将pgilinux-10.2.tar.gz解压缩: tar -zxvf 存放目录/pgilinux-10.2.tar.gz 将pgilinux-10.2-patch.tar.gz 里的 makelocalrc 替换 pgilinux-10.2/linux86/10.2/bin/下的makelocalrc文件,(为了解决gblic版本问题,见另一篇“pgi安装问题汇总”) 切换到root用户 su mkdir /opt/pgi 将pgilinux-10.2-patch.tar.gz里的PGI.Workstation.Complete.v10.2.LINUX.x64_Crack/pgi_10.2.0_linux32_patch拷贝到/opt/pgi 里,然后将其改为可执行文件: chmod +x pgi_10.2.0_linux32_patch 再将pgilinux-10.2-patch.tar.gz里的PGI.Workstation.Complete.v10.2.LINUX.x64_Crack/license.dat 拷贝到/opt/pgi 里 进入目录pgilinux-10.2 开始安装 ./install Do you accept these terms? Accept 1. Single system install 2. Network install Please choose install option(1-2): 1 Install the ACML? y Installation directory? /opt/pgi Do you wish to install MPICH1?(y/n) n Do you want the files in the install directory to be read-only? n 安装完成 开始设置环境变量 见博文“PGI-linux-10.2 安装问题汇总” 。 pgilinux-10.2-patch.tar.gz
PGI-linux-10.2 安装问题汇总 PGI是Portland公司开发的编译器,可以编译高性能的fortran(77、9X)、C、C++,尤其是对AMD CPU优化非常好。这里汇总了安装过程中最常见的问题以及解决方案。 一、bash环境设置 相关问题 :安装成功后,运行pgf90等命令显示“bash: pgf90: command not found”。 解决 :在.bashrc或者.bash_profile中设置环境,做法如下(以我安装pgi10.2为例) cd ~ vim .bashrc 然后在最后追加 export PATH=/opt/pgi/linux86/10.2/bin:$PATH export MANPATH=$MANPATH:/opt/pgi/linux86/10.2/man:$MANPATH export LM_LICENSE_FILE=/opt/pgi/license.dat export LM_LICENSE_FILE =/opt/pgi /license.dat 保存退出 然后source .bashrc 同样切换到root用户下(输入su) cd /root gedit .bashrc 添加同样的环境变量 保存退出 然后source .bashrc 再输入pgf90,显示: pgf90-Warning-No files to process 说明设置成功! 二、glibc、crtbegin.o问题 问题: 受 系统安装的gcc编译器版本的影响,安装pgi有时候会遇到,例如我在安装pgi6.0-5时出现 ERROR: unknown glibc version (2.4),或者还有朋友遇到安装完毕后用pgf90编译fortran程序提示找不到crtbegin.o文件,这属于同一问题。 实际上pgi各模块已经写在硬盘上了,但是环境没设置好,所以还是不能工作。 具体原因: 由于安装文件中的makelocalrc不能正确生成localrc,所以pgi不能正常工作,这与使用哪个发行版无关. 解决方案: 以我的系统为例,我用ubuntu10.04,安装pgi 10.2 1. (不推荐!) 手动编写一个文本文件localrc,放在/usr/pgi/linux86/6.0/bin目录下 set LFC=-lg2c; set LDSO=/lib/ld-linux.so.2; set GCCDIR=/usr/lib/gcc/i486-linux-gnu/4.1.2; set GCCINC=; set G77DIR=/usr/lib/gcc/i486-linux-gnu/3.4.6/; set LOCALRC=YES; set THROW=__THROW=; set HAMMER=; set X86_64=; 这一方案简单,但是对于我运行ecomsed的makefile文件,并不管用!!! 2. (推荐第二种!!!) 用如下文件替换安装目录中的makelocalrc文件,然后重新安装(该文件需要设置为可执行) (忘了抄的哪位高手的) 主 要在66,267行附近,314行附近的改动是为了解决安装错误 : /usr/pgi/linux86/6.1/bin/makelocalrc: line 315: =安装: / u sr/l ib/gcc/i386-re dhat- linux/4.1.0/: 没有那个文件或目 录. 修改后的makelocalrc如下(修改部分已用整行长注释条标出): #! /bin/sh ## ## Copyright 1990-2000, The Portland Group, Incorporated. ## Copyright 2000-2005, STMicroelectronics, Incorporated. ## All rights reserved. ## ## STMICROELECTRONICS, INCORPORATED PROPRIETARY INFORMATION ## This software is supplied under the terms of a license agreement ## or nondisclosure agreement with STMicroelectronics and may not be ## copied or disclosed except in accordance with the terms of that ## agreement. ## # Just in case PATH=/usr/bin:/bin:$PATH TMPDIR=${TMPDIR:-/tmp} usage() { echo "Usage: $0 installdir" echo echo "Example: $0 -x /usr/pgi/linux86/6.1" quit 1 } quit() { # Cleanup scratch files. rm -rf $scratch exit $1 } copy_files() { # $1 is source dir, $2 is destination dir if test -n "$1"; then if test -d "$1"; then if test ! -d $2 ; then mkdir $2 fi ( cd $1 ; tar cf - * | ( cd $2; tar xpf - )) fi fi } pretty_print() { echo $@ | awk -F^ '{printf("%20-s %s\n",$1,$2);}' } print_line() { echo $1 $2 $3 $4 $5 $6 $newrc } get_glibc_version() { # Determine the GNU LIBC version. if test -r /lib64/libc.so.6 ; then LIBC=/lib64/libc.so.6 # should only exist on a 64-bit Linux OS. elif test -r /lib/libc.so.6 ; then LIBC=/lib/libc.so.6 # should exist on any Linux OS. else echo "ERROR: /lib/libc.so.6: not found or no read permission" quit fi x=`strings $LIBC | grep 'GNU C Library' | cut -d, -f1 | awk '{print $7}'` if test -n "$x" ; then ######################################################################################### GLIBC_VERSION=2.4.4 ##原来是"$x" else GLIBC_VERSION=2.4.4 ##原来是空的 ######################################################################################## fi unset x return } get_linker_version() { x=`grep collect2 $out | sed q | sed -e 's/.* -dynamic-linker //' -e 's/ .*//'` if test -n "$x" ; then LINKER=$x else LINKER= fi unset x return } get_specs_file() { # This command pipeline should be I18N-capable. x=`awk '/gcc.*specs/ {print $NF}' $out` if test -n "$x" ; then SPECSFILE=$x else SPECSFILE= fi unset x return } # Stop if not Linux. opsys=`uname -s | tr ' ' ' '` if test "$opsys" != "linux" ; then echo echo "$0: `uname -n` is not running Linux" quit 1 fi pgi50=1 noexec=1 ofile=0 use_pthreads=1 no_m32_support=0 check_crt_files=0 set_hammer_empty=0 gcc=gcc g77=g77 scratch=$TMPDIR/PGI-INSTALL.$$ if test ! -d $scratch ; then mkdir $scratch fi while test -n "$1"; do case $1 in -n ) noexec=1 ;; -x ) noexec=0 ;; -o ) ofile=1 ; noexec=0 ;; -gcc ) shift; gcc=$1 ;; -g77 ) shift; g77=$1 ;; * ) start=$1 ;; esac shift done if test -z "$start" ; then usage fi if test ! -d $start ; then echo "$0: $start: directory not found" usage fi if test "$start" = "." ; then start=`pwd` fi if test "$pgi50" -eq 1 ; then # Example: 5.0 and above: # start = /usr/pgi/linux86/5.0 # installdir = /usr/pgi/linux86 # version = 5.0 # base = /usr/pgi/linux86/5.0 # target = linux86 installdir=`dirname $start` version=`basename $start` base=$start target=`basename $installdir` else # Example: 4.1 and below: # start = /usr/pgi # installdir = /usr/pgi # base = /usr/pgi/linux # version = 5.0 # target = linux86 installdir=$start version=`cat $start/.release` base=$start/linux86 target="linux86" fi # Define target-specific options needed below. arch=`uname -m` case "${target}:${arch}" in linux86:x86_64 ) gccopt="-o $scratch/a.out -m32 -v" g77opt=$gccopt subdir="/32" check_crt_files=1 use_64bit_rcfiles=11 install_64_bit=0 lib=/lib usrlib=/usr/lib ;; linux86:* ) set_hammer_empty=1 gccopt="-o $scratch/a.out -v" g77opt=$gccopt use_64bit_rcfiles=10 install_64_bit=0 lib=/lib usrlib=/usr/lib ;; linux86-64:x86_64 ) gccopt="-o $scratch/a.out -v" g77opt=$gccopt lib=/lib64 usrlib=/usr/lib64 install_64_bit=1 use_64bit_rcfiles=0 ;; linux86-64:* ) echo "ERROR: target doesn't match architecture" exit 1 ;; esac localrc=$base/bin/localrc newrc=$scratch/localrc.$$ # Find the version of GLIBC used on this system so that the appropriate # files are copied from lib-linux86-g* to lib and/or liblf. LIBC=$lib/libc.so.6 if test ! -f $LIBC ; then echo "ERROR: file $LIBC: not found." quit 1 fi get_glibc_version # sets GLIBC_VERSION case "$GLIBC_VERSION" in 2.3.* ) glibc=232 LIB=$base/lib-linux86-g232 LIBLF=$LIB-lf INC=$base/include-g23 ;; 2.2.9* ) glibc=2293 LIB=$base/lib-linux86-g2293 LIBLF=$LIB-lf INC=$base/include-g222 ;; 2.2.5 ) glibc=225 LIB=$base/lib-linux86-g225 LIBLF=$LIB-lf INC=$base/include-g222 ;; 2.2.4 ) glibc=224 LIB=$base/lib-linux86-g224 LIBLF=$LIB-lf INC=$base/include-g222 ;; 2.2.2 ) glibc=222 LIB=$base/lib-linux86-g22 LIBLF=$LIB-lf INC=$base/include-g222 ;; 2.1.9* | 2.2*) glibc=22 LIB=$base/lib-linux86-g22 LIBLF=$LIB-lf INC=$base/include-g22 ;; 2.1. ) glibc=212 LIB=$base/lib-linux86-g212 ;; 2.1.1 ) glibc=211 LIB=$base/lib-linux86-g211 ;; #################################################################################### 2.4.4) ##这都是加上的 其实只要改GLIBC_VERSION glibc=232 ##对应上面半括号中较新版本版本号即可 LIB=$base/lib-linux86-g232 LIBLF=$LIB-lf INC=$base/include-g23 ;; ##################################################################################### * ) echo "ERROR: unknown glibc version ($GLIBC_VERSION)." quit 1 ;; esac # PGI software needs some of the gcc libraries. Run gcc to determine # to determine which linker and libraries are actually being used. type $gcc /dev/null 21 if test $? -eq 1 ; then echo "ERROR: gcc not found;" echo " successful use of compilers requires existence of gcc libraries" quit 1 fi cfile=$scratch/hello-$$.c ffile=$scratch/hello-$$.f cat $cfile EOF_HELLO_C #include stdio.h #include stdlib.h main(){ printf("Hello world!\n"); exit(0); } EOF_HELLO_C cat $ffile EOF_HELLO_F program hello write(*,100) 100 format('Hello world!') end EOF_HELLO_F out=$scratch/gccrun.$$ $gcc $gccopt $cfile $out 21 if test ! -s $out ; then echo "ERROR: gcc failed to execute for reasons unknown." quit 1 fi ######################################################################## ####$gccbase=`$gcc -print-search-dirs | sed -e 's/^install: //' -e 1q` ####if test -d $gccbase$subdir ; then #### GCCDIR="$gccbase$subdir" ##原有的 ####fi ####gccversion=`$gcc -dumpversion` ####################################################################### libgcc=`$gcc -print-libgcc-file-name` gccbase=`dirname $libgcc` GCCDIR="$gccbase$subdir" ##自己加的 gccversion=`basename $gccbase` ########################################################################## # Check and see whether directory that gcc claims to exist actually # does exist. if test ! -d $gccbase ; then echo "ERROR: directory $gccbase: not found;" echo " successful use of compilers requires existence of gcc libraries!" quit 1 fi if test -d ${gccbase}include ; then GCCINC=${gccbase}include else unset GCCINC fi # Find the linker get_linker_version # returns LINKER if test ! -x $LINKER ; then echo "ERROR: Linker $LINKER: not found" quit 1 fi # Which g77? PGI software needs the g77 libraries, so look for the g77 libs. type $g77 /dev/null 21 if test $? -eq 1 ; then echo "WARNING: g77 not found; this may cause problems during use" G77DIR='""' else out=$scratch/g77run.$$ $g77 $g77opt $ffile $out 21 libgcc=`$g77 -print-libgcc-file-name` g77base=`$g77 -print-search-dirs | sed -e 's/^install: //' -e 1q` if test -d $g77base$subdir ; then G77DIR="$g77base$subdir" else G77DIR='""' fi f2c=`cat $out | grep lf2c` g2c=`cat $out | grep lg2c` if test -n "$f2c" ; then G77LIB="-lf2c" fi if test -n "$g2c" ; then G77LIB="-lg2c" fi fi if test -n "$G77LIB" ; then print_line "set LFC=$G77LIB;" fi # Which dynamic linker? if test "$LINKER" != "/lib/ld-linux.so.1" ; then print_line "set LDSO=$LINKER;" fi # CDK uses its own libmpich.a. if test -f "$base/bin/mpirun" ; then print_line "set MPILIB=$base/lib;" MPILIB=$base/lib/libmpich.a fi print_line "set GCCDIR=$GCCDIR;" print_line "set GCCINC=$GCCINC;" print_line "set G77DIR=$G77DIR;" #Add setaff_bind.o and -lnuma at link line x=$base x=`echo $x | sed -e 's/.*86-64.*/86-64/'` if test "$x" = "86-64" ; then if test -e $usrlib/libnuma.so ; then print_line 'set NUMAOBJS=$COMPLIBOBJ/setaff_bind.o;' print_line "set NUMALIBS=-lnuma;" fi fi if test $pgi50 -eq 0 ; then print_line "set STDRPATH=-rpath \$PGI/linux86/lib;" fi print_line 'set LOCALRC=YES;' if test "$noexec" -eq 1 ; then pretty_print 'PGI directory' ^ $installdir pretty_print 'PGI version' ^ $version pretty_print 'PATH entry' ^ "$base/bin" pretty_print 'System linker' ^ $LINKER pretty_print 'GCC directory' ^ $GCCDIR pretty_print 'GCC headers' ^ $GCCINC pretty_print 'G77 directory' ^ $G77DIR pretty_print 'G77 headers' ^ $G77LIB if test -n "$GLIBC_VERSION" ; then pretty_print 'GNU C version' ^ $GLIBC_VERSION pretty_print 'PGI glibc libs' ^ $LIB pretty_print 'PGI glibc headers' ^ $INC else pretty_print 'Glibc version' ^ 'no' fi if test -n "$LIBLF" ; then pretty_print 'Large file support' ^ $LIBLF else pretty_print 'Large file support' ^ 'no' fi if test -n "$MPILIB" ; then pretty_print 'MPILIB' ^ $MPILIB fi if test $use_pthreads -eq 1 ; then pretty_print 'Threads' ^ "$usrlib/libpthread.{a,so}" else pretty_print 'Threads' ^ "$base/lib/libpgthread.{a,so}" fi if test $no_m32_support -eq 1 ; then pretty_print 'gcc supports -m32' ^ 'no' else pretty_print 'gcc supports -m32' ^ 'yes' fi quit 0 fi # Make the necessary changes to meet glibc dependencies. if test -n "$glibc" ; then copy_files $LIB $base/lib case "$glibc" in 22* | 23* ) copy_files $INC $base/include print_line "set THROW=__THROW=;" ;; 21* ) ;; esac # Large file support. if test -n "$LIBLF" ; then copy_files $LIBLF $base/liblf else rm -rf $base/liblf fi # Newer distributions of Linux do not need PGI-compiled versions of # threads libraries. if test $use_pthreads -eq 1 ; then # Only create a symlink if the target file exists and # the link does not. if test -e $usrlib/libpthread.a ; then if test ! -h $base/lib/libpgthread.a ; then ln -s $usrlib/libpthread.a $base/lib/libpgthread.a fi fi if test -e $lib/libpthread.so.0 ; then if test ! -h $base/lib/libpgthread.so ; then ln -s $lib/libpthread.so.0 $base/lib/libpgthread.so fi fi fi # Adjust header files based on the gcc version. need_stddef=1 case "$gccversion" in 3.3* ) copy_files $base/include-gcc33 $base/include ;; 3.4* ) copy_files $base/include-gcc34 $base/include need_stddef=0 ;; 4.* ) copy_files $base/include-gcc40 $base/include need_stddef=1 ;; * ) ;; esac if test $need_stddef -eq 0 ; then rm -f $base/include/stddef.h fi # Changes for 32-bit installs. if test $set_hammer_empty -eq 1 ; then print_line "set HAMMER=;" print_line "set X86_64=;" fi if test $install_64_bit -eq 0 ; then if test -f /etc/redhat-release ; then grep 'release 9' /etc/redhat-release /dev/null 21 if test $? -eq 0; then print_line "set LBSTAT=-lpthread -lpthread_nonshared;" fi fi fi # Stock distributions may need extra help in finding crt files. if test $check_crt_files -eq 1 ; then if test ! -f /usr/lib64/32/crt1.o ; then print_line "set DEFLIBDIR=/usr/lib;" print_line "set DEFSTDOBJDIR=/usr/lib;" print_line "set EXTRAASARGS=--32;" fi fi # For production installations, recover some space by unneeded files. if test "$version" != "dev" ; then rm -rf $base/include-g* echo $GLIBC_VERSION $base/glibc_version fi # Fix the 32/64-bit .*rc files. if test $use_64bit_rcfiles -eq 11 ; then files=`ls -1 $base/bin/.pg*-64 2/dev/null` for i in $files ; do x=`echo $i | sed -e 's/-64$//'` mv -f $i $x done rm -f $base/bin/.pg*-32 /dev/null 21 elif test $use_64bit_rcfiles -eq 10; then files=`ls -1 $base/bin/.pg*-32 2/dev/null` for i in $files ; do x=`echo $i | sed -e 's/-32$//'` mv -f $i $x done rm -f $base/bin/.pg*-64 /dev/null 21 fi fi # Add timestamp and username. print_line '# makelocalrc executed by ' `whoami` `date` # If $ofile is set, then display the file to stdout. Otherwise, write # it to $localrc. if test $ofile -eq 1 ; then echo "##### localrc contents #####" cat $newrc echo "############################" rm -f $newrc else if test -f $localrc ; then mv -f $localrc $localrc.bak chmod -f 0644 $localrc.bak fi mv -f $newrc $localrc chmod -f 0644 $localrc fi # Copy omp_lib.mod from lib directory to include directory echo if test -f $base/lib/omp_lib.mod ; then cp -f $base/lib/omp_lib.mod $base/include/omp_lib.mod fi if test -f $base/lib/omp_lib_kinds.mod ; then cp -f $base/lib/omp_lib_kinds.mod $base/include/omp_lib_kinds.mod fi quit 0 ( 过程中 注意:找到软件包中的 makelocalrc文件(linux86/bin下),用新的文件替换,同时 应该增加 makelocalrc 可执行权限:chmod +x makelocalrc,很明显,无此步骤照样不成功) 转自:http://blog.163.com/xiaowei_090513/blog/static/1177183592009527111837605/
创建动态链接库主要有两种方法: 一种是使用Matlab 为VC++ IDE提供的Add-in。这种方法比较简单,方便快捷,只要在VC++中创建工程的时候选择Matlab Project Wizard,并且在接下来的Step 1 中的Visual Matlab Application Type选择Shared M-DLL 就可以了。接下来就是添加*.m 文件, 进行编译了。另一种方法就是使用Matlab 的mcc 命令将*.m文件编译为动态链接库( *.DLL)。因为Add-in 也是调用Compiler 的命令mcc 进行编译工作的, 而且有时候这个Add-in 还会出现不能使用的情况, 因此这里主要讨论使用mcc 命令的方法。 关于mcc 有很多参数可以使用, 而且有多种用法,主要参数如下: Bold entries in the Comment/Options column indicate default values -a filename Add filename to the CTF archive 无 -b Generate Excel-compatible formula function Requires MATLAB Builder for Excel -B filename ] Replace -B filename on the mcc command line with the contents of filename The file should contain only mcc command line options. These are MathWorks included options files: -B csharedlib:fooC shared library -B cpplib:fooC++ library -c 生成C语言包装函数 Equivalent to -T codegen -d directory 输出到指定目录 无 -f filename Use the specified options file, filename, when calling mbuild mbuild -setup is recommended. -g 生成 debugging 信息 无 -G 同 -g 无 -I directory Add directory to search path for M-files MATLAB path is automatically included when running from MATLAB, but not when running from DOS/UNIX shell. -l 创建库函数的宏 等效于命令 -W lib -T link:lib -m 生成C语言独立运行程序的宏 等效于命令 -W main -T link:exe -M string 传递字符串给 mbuild Use to define compile-time options. -N Clear the path of all but a minimal, required set of directories 无 -o outputfile 制定最终可执行文件的名字 Adds appropriate extension -P directory Add directory to compilation path in an order-sensitive context Requires -N option -R option Specify run-time options for MCR option = -nojvm -nojit -S Create Singleton MCR Requires MATLAB Builder for COM -T target Specify output stage target = codegen compile: bin link: bin where bin =exe lib -v 显示详细; 显示编译步骤 无 -w option 显示警告信息 option = list level level :string where level =disable enable error -W type Control the generation of function wrappers type = main cpplib:string lib:string none com:compname,clname,version -Y licensefile Use licensefile when checking out a Compiler license 无 -z path 指定库文件和包含文件的路径 无 -? 显示帮助信息 无 Feedback
单机4核(intel core2 quard)32位vasp并行安装 本人同时在小木虫上发了此贴,非转载他人,若转载请注明出处作者abcasi 原创 单机4核(intel core2 quard)32位vasp并行安装 采用IFC编译器,MKL数据库mpich2-1.0.8对VASP编译的过程 1. 准备 系统为suse linux enterprise Desktop service Pack2 For x86 VASP源代码(vasp.4.6.tar.gz和vasp.4.lib.tar.gz),mkl数据库 (l_mkl_p_9.1.023.tar),ifc编译器(l_fc__pl_9.1.036.tar.gz),mpich2-1.0.8。我们将以上 安装所需文件都放在/root/vasp目录下并解压。测试成功效率在95%以上 2. Ifc编译器安装 先解压tar –zxvfl_fc_c_9.1.036.tar.gz 得到l_fc_c_9.1.036.文件夹 进入l_fc__pl_9.1.036文件夹找到install.sh文件 执行./install.sh开始安装ifc,安装过程都选用默认的路径(/opt/intel/fc/9.1.036)安装 安装完毕,进入/opt/intel/fc/9.1.036/bin目录 执行cp ifort /bin ifc安装完成 3. mkl的安装 进入l_mkl_p_9.1.023.tar所在目录 tar –zxvf l_mkl_p_9.1.023.tar 进入解压得到的目录l_mkl_p_9.1.023 进入install文件夹,可以看到一个可执行的文件install ./install.sh 默认安装即可,默认目录为/opt/intel/mkl/9.1.023 三 ,设置环境变量 编辑root下的 .bashrc # .bashrc # User specific aliases and functions alias rm='rm -i' alias cp='cp -i' alias mv='mv -i' PATH="$PATH:/usr/local/bin" (安装mpich2要添加的路径) # Source global definitions if ; then . /etc/bashrc fi export LD_LIBRARY_PATH=/opt/intel/mkl/9.1.023/lib/32:/opt/intel/fc/9.1.036/lib . /opt/intel/fc/9.1.036/bin/ifortvars.sh (新添加路径) export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/intel/mkl/9.1.023/lib/32 (新添加路径) 二、安装MPICH2(在节点root目录下) 1、解压缩 #tar -zxvf mpich2-1.0.1.tar.gz 或者 #gunzip -c mpich2-1.0.1.tar.gz|tar xf mpich2-1.0.1.tar 2、创建安装目录 #mkdir /usr/MPICH-instsll 3、进入mpich2解压目录 #cd mpich2-1.0.1 4、默认安装目录 #./configure 5、编译 #make 6、安装 #make install 7、退出到root目录 #cd .. 8、通过编辑.bashrc文件修改环境变量 #vi .bashrc 修改后的.bashrc文件如下: # .bashrc # User specific aliases and functions alias rm='rm -i' alias cp='cp -i' alias mv='mv -i' PATH="$PATH:/usr/local/bin" (新增加的mpich2的路径) #Source global definitions if ; then . /etc/bashrc fi export LD_LIBRARY_PATH=/opt/intel/mkl/9.1.023/lib/32:/opt/intel/fc/9.1.036/lib . /opt/intel/fc/9.1.036/bin/ifortvars.sh (新添加路径) export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/intel/mkl/9.1.023/lib/32 (新添加路径) 9、测试环境变量设置 #which mpd #which mpicc #which mpiexec #which mpirun 10、修改/etc/mpd.conf文件,添加内容为secretword=myword #vi /etc/mpd.conf 添加 secretword=myword 设置文件读取权限和修改时间 #touch /etc/mpd.conf #chmod 600 /etc/mpd.conf 1、本地测试 #mpd 启动 #mpdtrace 观看启动机器 #mpdallexit 退出 三。 6.进入vasp.4.lib所在目录 cd /root/vasp/vasp.4.lib cp makefile.linux_ifc_P4 makefile 根据自己机子的情况选择合适的makefile 编辑makfile 19行的FC=ifc 修改为 FC=ifort make 如果编译通过,说明前面安装的数学库和编译器等都是正确的 7.进入vasp.4.6所在目录 cd/root/vasp/vasp.4.6 cp makefile.linux_ifc_P4 makefile 编辑 makefile 对makefile做如下修改: 50行, 52行 前加# 80行前加 # 128行 的#BLAS=-L/opt/intel/mkl/lib/32 -lmkl_p4-lpthread 修改为 BLAS=-L/opt/intel/mkl/9.1.023/lib/32 -lmkl_p4 -lsvml -lvml -lguide -lpthread 136行前加 # 145 行 的 #LAPACK= -lmkl_lapack 修改為LAPACK= -lmkl_lapack 或 LAPACK=-L/opt/intel/mkl/9.1.023/lib/32 -lmkl_lapack -lsvml -lvml -lguide –lpthread 也可以 149行 前 加 # 166行 前 加 # 201行 的 #FC=mpif77 修改為 FC=mpif90 202行的 #FCL=$(FC) 修改為 FCL=$(FC) 211-214行 前面的 # 去掉 修改為 CPP = $(CPP_) -DMPI-DHOST=\"LinuxIFC\" -DIFC \ -Dkind8 -DNGZhalf -DCACHE_SIZE=4000 -DPGF90 -Davoidalloc \ -DMPI_BLOCK=500\ -DRPROMU_DGEMV-DRACCMU_DGEMV 224行 前 加 # 227行 前 加 # 233-235行 前 的# 去掉 238行 前 的 # 去掉 343行 的-e95去掉 保存退出后 编译make 编译通过则 cp vasp /bin 在任何目录下vasp命令都可以调用了 这时编译的vasp只能在root用户下使用 四.重启电脑,以普通用户(XXX代表普通用户名)的身份登陆 1. 进入 /home/XXX目录找到隐藏的.bashrc文件(在窗口的工具栏中点击“查看”,选择显示隐藏文件) .bashrc 文件如下 # Sample .bashrc for SuSE Linux # Copyright (c) SuSE GmbH Nuernberg # There are 3 different types of shells in bash: the login shell, normal shell # and interactive shell. Login shells read ~/.profile and interactive shells # read ~/.bashrc; in our setup, /etc/profile sources ~/.bashrc - thus all # settings made here will also take effect in a login shell. # # NOTE: It is recommended to make language settings in ~/.profile rather than # here, since multilingual X sessions would not work properly if LANG is over- # ridden in every subshell. # Some applications read the EDITOR variable to determine your favourite text # editor. So uncomment the line below and enter the editor of your choice :-) #export EDITOR=/usr/bin/vim #export EDITOR=/usr/bin/mcedit # For some news readers it makes sense to specify the NEWSSERVER variable here #export NEWSSERVER=your.news.server # If you want to use a Palm device with Linux, uncomment the two lines below. # For some (older) Palm Pilots, you might need to set a lower baud rate # e.g. 57600 or 38400; lowest is 9600 (very slow!) # #export PILOTPORT=/dev/pilot #export PILOTRATE=115200 test -s ~/.alias . ~/.alias || true 修改后变为 # Sample .bashrc for SuSE Linux # Copyright (c) SuSE GmbH Nuernberg # There are 3 different types of shells in bash: the login shell, normal shell # and interactive shell. Login shells read ~/.profile and interactive shells # read ~/.bashrc; in our setup, /etc/profile sources ~/.bashrc - thus all # settings made here will also take effect in a login shell. # # NOTE: It is recommended to make language settings in ~/.profile rather than # here, since multilingual X sessions would not work properly if LANG is over- # ridden in every subshell. # Some applications read the EDITOR variable to determine your favourite text # editor. So uncomment the line below and enter the editor of your choice :-) #export EDITOR=/usr/bin/vim #export EDITOR=/usr/bin/mcedit # For some news readers it makes sense to specify the NEWSSERVER variable here #export NEWSSERVER=your.news.server # If you want to use a Palm device with Linux, uncomment the two lines below. # For some (older) Palm Pilots, you might need to set a lower baud rate # e.g. 57600 or 38400; lowest is 9600 (very slow!) # #export PILOTPORT=/dev/pilot #export PILOTRATE=115200 test -s ~/.alias . ~/.alias || true 以下为增加内容 export LD_LIBRARY_PATH=/opt/intel/mkl/9.1.023/lib/32:/opt/intel/fc/9.1.036/lib . /opt/intel/fc/9.1.036/bin/ifortvars.sh (新添加路径) export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/intel/mkl/9.1.023/lib/32 (新添加路径) 保存, 2. 配置mpd 在普通用户下 执行 cd $HOME vi .mpd.conf 添加 MPD_SECRETWORD=mr45-j9z 保存, 设置文件读取权限和修改时间 touch .mpd.conf chmod 600 .mpd.conf 设置完成。 上述编译通过的vasp还不能运行,会提示找不到目标文件libsvml.so 1.locate libsvml.so可以找到libsvml.so所在目录/opt/intel_fc_80/lib中 2.在root目录下找到.bash_profile和.bashrc文件(ls –a 显示当前目录下所有内容 3.在root目录下运行env看环境变量LD_LIBRARY_PATH是否为 LD_LIBRARY_PATH=/opt/intel/mkl/8.0.2/lib/32: /opt/intel/fce/9.1.036/lib 若不是则执行如下命令 export LD_LIBRARY_PATH=/opt/intel/mkl/8.0.2/lib/32: /opt/intel/fce/9.1.036/lib 4.reboot后即可以使用vasp 计算了
我想若从形式化角度研究WSN/DSN协议,形式语义是必不可少的工具,而形式语义与Functional Languages关系密切,所以我准备2周时间学习一下SML。条件有限,OS为Windows,书采用了L.C.Paulson《ML for the Working Programmer》,中文版是柯韦译的《ML程序设计教程》,编译器为SML/NJ。以后可加装Debain Linux,真怀念我原来配置的Debain 5.0系统! 1。如何编译SML文件? notes-011001.pdf A:SML多采用行命令编译方式,用惯了C(Gnu Linux / Windows),特不适应SML行命令方式,主要是不宜于调试。只好读其指南,看看有方法简化编译: 引自《Notes on Programming Standard ML of New Jersey》一书: 建立foo.sml 文件: fun double (x:int):int = 2 * x; fun square (x:int):int = x * x; fun power (x:int,y:int):int = if (y=0) then 1 else x * power (x,y-1); 获取当前工作目录: OS.FileSys.getDir: - OS.FileSys.getDir (); 修改 - OS.FileSys.chDir /home/riccardo/work/sml; 例如: foo.sml在C盘 设置 - OS.FileSys.chDir C:\\; - use foo.sml; sml-tutorial.pdf Standard ML http://en.wikipedia.org/wiki/Standard_ML#References Alice ML: http://www.ps.uni-saarland.de/alice/