2008年12月23日

error of unable to load c2.dll

Fatal error LNK1171: unable to load c2.dll

We had an interesting problem arise where linking a Release mode static library written in C with a Fortran application using the Premier Partner edition of Visual Studio that ships with Intel Visual FORTRAN 10 would die at the linking stage. This happened late in the game as the debug mode builds of the C library did not exhibit this error. To make matters worse, if users had any other version of Visual Studio with just the Intel Visual FORTRAN Compiler Integration installed, no such problems arose.

Our first step was to install the Platform SDK: no joy. The second step was to manually copy the DLL's required (there are actually 3 DLL's you need) from a working install to the non-working install: success!

So, what could possibly be the problem here?

No amount of searching could turn up the issue, so a ticket was opened with Intel's Premier Support. Well, we should have done this from the beginning because it appears that the compiler writers themselves know a lot about the compiler toolchain; fancy that. The (relevant) response from Intel:
c2.dll is used by the Microsoft Visual C++ compiler to perform whole-program optimization. Might it be that this "release" C library was compiled with that option? If so, you will require Visual C++ to be installed in order to build using that library.

My advice is that if you know you will be linking a C library on a system with only Visual Studio Premier Partner Edition installed that you be sure that Whole Program Optimization is disabled, as otherwise Fortran programmers will not be able to use it.
Sure enough, disabling Whole Program Optimization on the Release mode builds of the C static library solved all of our issues.Fatal error LNK1171: unable to load c2.dll
We had an interesting problem arise where linking a Release mode static library written in C with a Fortran application using the Premier Partner edition of Visual Studio that ships with Intel Visual FORTRAN 10 would die at the linking stage. This happened late in the game as the debug mode builds of the C library did not exhibit this error. To make matters worse, if users had any other version of Visual Studio with just the Intel Visual FORTRAN Compiler Integration installed, no such problems arose.

Our first step was to install the Platform SDK: no joy. The second step was to manually copy the DLL's required (there are actually 3 DLL's you need) from a working install to the non-working install: success!

So, what could possibly be the problem here?

No amount of searching could turn up the issue, so a ticket was opened with Intel's Premier Support. Well, we should have done this from the beginning because it appears that the compiler writers themselves know a lot about the compiler toolchain; fancy that. The (relevant) response from Intel:
c2.dll is used by the Microsoft Visual C++ compiler to perform whole-program optimization. Might it be that this "release" C library was compiled with that option? If so, you will require Visual C++ to be installed in order to build using that library.

My advice is that if you know you will be linking a C library on a system with only Visual Studio Premier Partner Edition installed that you be sure that Whole Program Optimization is disabled, as otherwise Fortran programmers will not be able to use it.
Sure enough, disabling Whole Program Optimization on the Release mode builds of the C static library solved all of our issues.

2008年12月21日

compile PPM library

1. Introduction 
This article is focus on the compile the PPM library on widows, using Intel Fortran compiler.
The acronym PPM stands for Parallel Particle Mesh library. PPM is a software layer between the Message Passing Interface (MPI) and codes for simulations of physical systems using hybrid particle-mesh methods. The library is developed based on a unifying formulation for the simulations of discrete and continuous systems using particles. In this formulation the well known grid-free character of the method is relaxed by the introduction of a mesh for the reinitialization of the particles, the computation of the field equations, and the discretization of differential operators.

2.Libraries used in PPM library.
The PPM library used four  libraries:MPI, fftw, metis,vizing. Before compile PPM library, the above four libraries needed to be compiled. 
3.1 compile MPI library:
The MPICH2 is used as MPI library, which can be downloaded from the website.http://www.mcs.anl.gov/research/projects/mpich2/ install the MPICH then the MPI library is installed.
3.2 metis library:
metis library is the demoain decomposssion library. the source file can be download at http://glaros.dtc.umn.edu/gkhome/metis/metis/download  The metis install introduction is based on linux, for windows. The Microsoft visual studio is used to compile the metis library. 
(1) Create a static library in MS 
(2)  " #define __VC__" at the first line of "metis.h". Then the libaray will use rand instead of srand48 and drand48 function.
(3) comment the word "extern "c" " in  file "balance.c", this is becuase "extern "c" " is the keyword in c++, there is no "extern "c"" in c standard. 
 (4) make sure that the run time library is "multi threaded", by default the MS us " multi threaded DLL"
3.2 vizing library:
the vizing library is called by PPM library for neighboring communication. download the vizing library. and create the static library as the metis library. 
 (1) make sure that the run time library is "multi threaded", by default the MS us " multi threaded DLL"

2008年12月20日

complie fftw in MKL

MKL has fftw in it. But you need to cimpile it before using. 
The compile procedure is reference by "FFTW to Intel® Math Kernel Library Wrappers Technical User Notes for FFTW 2.x". compiler procedure is specified as bleow:
1. copy the head file from ".\include\fftw" to ".\interfaces\fftw2xf";
2.execute the ms compiler in start menu->msdv->tool
3.execute : " nmake lib32 F=ms"    to build 32 library;
4.execute:" nmake libem64t F=ms" to build 64 library;
if the 4 have erroe. change the make file of line:
"
libem64t:                   
IF /I $F==ms ( exit ) ELSE ( nmake ..\..\em64t\lib\fftw2xf_$F.lib IE=i ARCH=em64t )"
to 
"
libem64t:                   
( nmake ..\..\em64t\lib\fftw2xf_$F.lib IE=i ARCH=em64t )
"
5. The complied library can be found in ".\MKL\lib"

2008年12月16日

WinCVS与CVSNT简明使用手则(1,2)

    WinCVS与CVSNT简明使用手则(一)

  1. 2003-11-14 @ Tag 开发工具   人气:92594

    1       前言:

    CVS是版本控制的利器,目前在LinuxWindows下都有不同版本;但是国内大多数应用介绍都是基于Linux等开放源代码的开放性软件组织,而且讲解的也不系统,让人摸不着头脑;Windows下的CVS使用介绍更是了了无几。

    本文是针对WindowsLAN环境下使用CVS的经验介绍,一步一步的向您介绍如何配置和使用CVS的服务器端和客户端。同时,本文只使用到了CVS当中最基本的东西,还有很多更为高级的东西,本文暂不涉及。下面是本文的另一个连接映射,欢迎大家讨论使用,共同进步。

    文章连接:http://www.kuihua.net/book/list.asp?id=66

    论坛连接:http://www.kuihua.net/bbs/dispbbs.asp?boardID=1&RootID=670&ID=670

    2       安装版本:

    2.1    服务器端(CVSNT)

    1.         本文使用的是CVSNT-2.0.4这是一个比较稳定的版本,不要使用最新的CVSNT-2.1.1本人在使用中发现有比较严重的Bug

    2.         下载连接:http://www.cvsnt.org目前,它提供2.0.62.1.1版本的下载。

    3.         上面连接还提供源代码,有兴趣的朋友还可以下载下来仔细研究:)。

    4.         有心的朋友,仔细观察就会发现:http://www.cvsnt.org并没有提供任何客户端的下载,那是因为CVS.exe既可以用于服务器端又可以用于客户端,WinCVS是为了客户端使用的方便而定制的外壳。(关于这一点,本人未得到任何证实,只是本人在使用过程中的一种体会,欢迎大家讨论。)

    2.2    客户端(WinCVS)

    1.         本文使用的是WinCVS-1.3b13这应该是一个最新版本:),本人在使用过程中并没有发现有任何严重的Bug

    2.         下载连接:http://sourceforge.net/projects/cvsgui/

    3.         此网站还提供丰富的CVS文档和相关源代码,以及多个OS下面的相关文档和代码;有收藏癖的朋友有福了:)。

    4.         WinCVS-1.3b13 使用的CVSNT的版本是CVSNT-2.0.2在与服务器端的CVSNT-2.0.4 版本配合使用时,未发现任何不兼容或冲突现象。

    5.         在本人的系统中用cvs version命令显示的结果如下:

    Client: Concurrent Versions System (CVSNT) 2.0.2 (client/server)

    Server: Concurrent Versions System (CVSNT) 2.0.4 (client/server)

       服务器端(CVSNT)的安装与配置:

    3.1    服务器端机器和环境配置:

    1.         操作系统:Windows 2000 Professional SP2中文版

    2.         机器名称:Server

    3.         机器地址:192.168.0.6 (内部IP)

    4.         网络环境:100兆交换局域网

    5.         硬盘分区格式:FAT32NTFS都可以。

    6.         准备2CVSNT的工作目录:

    F:\KHRoot                    (存放自己源代码的根目录)

    F:\KHTemp                   (存放CVS出错信息的目录)

    7.         本机上存在有的用户列表:(由NT或本机的使用者创建)

    Administrator                (系统管理员)

    Jackey                         (普通用户)

    Goury                          (普通用户)

    Riolee                         (普通用户)

    3.2    安装CVSNT

    1.         下载CVSNT-2.0.4;使用administrator登陆到Server机器上。

    2.         双击自解压的exe文件,选择Full Install,其它按照默认方式安装;安装完毕后可以在服务控制器中发现多了2个服务:cvsntcvslocking

    3.         发送Service Control Panel到桌面,形成快捷方式。

    4.         安装程序会自动将CVS安装路径,设置到系统的Path环境变量当中,因此使用者可以在控制台(cmd)中任意位置执行cvs.exe,这一点对下面的配置很重要!!

    3.3    配置CVSNT服务器:

    1.         双击Service Control Panel快捷方式,在Service Status页面,确认2个服务正常和稳定运行。

    2.         选择Repository页面,点按Add按钮,选择已经准备好的F:\KHRoot这个目录,确认,OKYes,这时会在F:\KHRoot下面建立CVSRoot目录,这是CVS默认的管理目录(默认模块)。如果报错,那是系统Path路径未设置正确。

    3.         选择Advanced页面,勾上Use local users for pserver ...,(Why? I don’t know!J,Temporary栏选择已经准备好的F:\KHTemp,确认,OK

    4.         点按【应用】按钮,确认,退出,OK,搞定!!

    3.4    小结:

    1.         至此,CVSNT服务器端基本配置完毕,下面进行WinCVS的使用和管理。

    2.         由于CVS支持远程管理,也就是客户端与服务器集成的特性,因此,我们将添加用户、权限控制、模块维护等所有的管理工作都放到远端(WinCVS)进行管理,服务器端这时可以Ctrl+Atl+Del进入锁定状态了,下面的所有工作都交给远端的WinCVS来进行管理。

    4       客户端(WinCVS)的安装与配置:

    4.1    客户端机器和环境配置:

    1.         操作系统:Windows 2000 Professional SP2中文版

    2.         机器名称:YCW2000

    3.         机器地址:192.168.0.2 (内部IP)

    4.         网络环境:100兆交换局域网,可以直接访问到Server

    5.         硬盘分区格式:FAT32NTFS都可以。

    4.2    安装WinCVS

    1.         下载WinCVS 1.3b13,全部按照默认安装就可以了。

    2.         启动WinCVS,开始使用。特别注意:以下的所有操作都是在YCW2000(192.168.0.2)这台机器上远程完成的,此时的Server(192.168.0.6)主机已经进入了锁定状态。

    5       管理员使用WinCVS进行远程管理:

    5.1    配置WinCVS成管理员状态:

    1.         准备管理员工作目录:(YCW2000机器上)

    E:\CVSClient\Admin              (管理员工作目录)

    E:\CVSTemp                        (WinCVS临时目录)

    2.         第一次启动WinCVS时会自动弹出Preferences配置页面,也可以通过Admin=>Preference菜单进入;第一次使用时需要配置如下的3个页面:

    l         General页面设置:

    注:按照图示方式输入即可,需要注意的是Path部分的格式是Unix路径格式,它指的是CVSNT端设置的工作根目录。

     

    l         CVS页面设置:

    注:Home路径是设置密码等文件的存放位置,必须指定,否则在登陆时,WinCVS也要弹出设置框。这个Home路径需要Python.exe这个外挂程序才有效。这里选择已经准备好的路径:E\CVSTemp

     

    l         WinCVS页面设置:

    注:此页面设置WinCVS的外挂编辑程序,通常使用UltraEdit比较方便。

    3.         设置管理员的工作路径:可以点按图标 ,或View=>Browse Location=>Change…菜单进行设置,选择已经准备好的路径:E:\CVSClient\Admin,确认,OK,这时此目录将出现在WinCVS的左边导航栏【Workspace】内。

    4.         至此,WinCVS就被配置成了远程的管理员使用状态,下面进行一般管理员需要的基本操作演练。演练的内容为:Administrator需要管理JackeyGouryRiolee三个用户,分别为这3个用户建立工作目录,每个人只能访问自己的工作目录。同时,只有Administrator能够进行权限分配,其它人没有任何管理权限。

      WinCVS与CVSNT简明使用手则(二)

    1. 2003-11-14 @ Tag 开发工具   人气:37988

      5.2    管理员进行管理演练:

      1.         登陆远程CVSNT

      l         选择Admin=>Login菜单,默认设置,OK

      l         弹出密码输入框,确认,OK。注意观察输出框【OutPut】的返回结果。

      2.         Checkout默认模块:(CVSRoot管理模块)

      l         在左边导航栏【Workspace】内,选择【Admin】点按右键,选择【Checkout modules…】,在【Checkout settings】中输入CVSRoot,确定,OK。如下图:

      l         如果成功的话,会在【Admin】栏下增加一个【CVSRoot】目录。表示您已经将【CVSRoot】这个管理模块下载到本地了。

      3.         CVS中目录权限介绍:

      l         系统支持的目录权限列表:

      r             (读取权限)

      w           (写入权限)

      c            (创建和删除权限)

      n            (没有任何权限)

      l         默认情况下,任何用户都拥有任何目录的所有权限。

      l         任何情况下只有目录的拥有者和Administrator才有权力更改目录的使用权限。下面将会介绍如何修改目录权限和目录的拥有者。

      4.         修改CVSRoot的权限:只让Administrator拥有rcw三种全部权限。

      l         选中刚刚下载的【CVSRoot】模块,【Ctrl+L】或Admin=>Command Line…,弹出Command Line Settings对话框,直接执行CVS命令。

      l         取消所有用户的默认权限:cvs chacl default:n 回车,OK,完成。

      l         设置Administrator拥有所有权限:cvs chacl administrator:rcw 回车,OK,完成。

      l         更改【CVSRoot】的拥有者:cvs chown administrator 回车,OK,完成。

      l         查看【CVSRoot】的权限状态:cvs lsacl 回车,OK,在【Output】中显示:

      Owner:   administrator

                   default:n

                   administrator:rwc

      l         CVSRoot】的权限配置完毕。

      5.         编写代码库中的模块文件,便于多用户下载方便。

      l         需要自己编写的模块文件格式如下:(实现基本功能)

      【模块一的描述】【n个空格或参数】【相对目录路径一(DirA)

      【模块二的描述】【n个空格或参数】【相对目录路径二(DirB)

                                         ……

      【模块X的描述】【n个空格或参数】【相对目录路径X(DirX)

      l         【描述信息】与【相对路径】在字面上不一致时,需要使用-a参数。

      l         【相对路径】指的是CVS会自动带上根路径,这里是F:\KHRoot,所以上面例子的完整路径为:F:\KHRoot\DirA

      l         了解了模块文件结构,现在来实际操作一把:双击【CVSRoot】模块下的modules文件,用UltraEdit打开进行编辑。

      l         JackeyGouryRiolee三个用户分配工作目录和完成其它模块描述。

      CVSRoot                      CVSRoot

      Jackey工作目录    -a    Jackey

      Goury工作目录    -a    Goury

      Riolee工作目录     -a    Riolee

      l         编辑完毕,存盘。回到WinCVS,选中modules这个文件【Ctlr+M】或右键选择【Commit selection…】,默认设置,【确认】,OK,完成上传。

      6.         为三个用户分别上传工作目录:

      l         YCW2000机器上的E:\CVSClient\Admin分别建立三个目录分别名为:JackeyGouryRiolee,作为临时交换目录。

      l         在新创建的每个目录中用UltraEdit或拷贝一个Readme.txt作为引子文件!!:)

      l         然后,回到WinCVS,在【Workspace】栏的【Admin】目录下形成如下的目录结构:

      l         分别选中GouryJackeyRiolee,右键,点按【Import Module】,选择【Continue】,其它全部使用默认值,【确定】,OK,完成上传工作。

      l         仔细观察【Output】窗口,确认都成功上传了。

      l         转移到系统的Explore程序中,删除E:\CVSClient\Admin目录下的JackeyGouryRiolee三个目录。然后回到WinCVS当中。(一定要删除!!!:)

      l         至此,就完成了工作目录的上传工作。

      7.         Checkout】下载3个用户的工作目录到【Admin】目录下:

      l         在【Workspace】栏选择【Admin】目录,右键,点按【Checkout Module…,如下图:

       

      l         选择【】,得到CVSNT上最新的模块配置情况,弹出如下的信息框:

      l         这个结构图就是刚才在modules当中编写的模块文件格式信息。选择【Jackey工作目录】,下载到YCW2000机器的E:\CVSClient\Admin目录下。

      l         按照以上操作,依次分别下载【Goury工作目录】和【Riolee工作目录】。形成如下状态:

      8.         为三个用户分别设置各自目录的访问权限。(只有自己才能访问自己的工作目录)

      l         选中【Goury】目录,【Ctrl+L】或Admin=>Command Line…,弹出Command Line Settings对话框,直接执行CVS命令。

      l         取消所有用户的默认权限:cvs chacl default:n 回车,OK,完成。

      l         设置Goury拥有所有权限:cvs chacl goury:rcw 回车,OK,完成。

      l         查看【CVSRoot】的权限状态:cvs lsacl 回车,OK,在【Output】中显示:

      Owner:   administrator

                   default:n

                   goury:rwc

      l         按照以上的方法依次分别设置【Jackey】与【Riolee】的工作目录访问权限。

      l         至此,完成了3个用户的目录权限分配。注意,虽然Administrator也没有权力再次【Checkout】那3个用户的工作目录,但是它是这些目录的拥有者又是Administrator,因此,只有它才有权力更改这些目录的访问权限。

      9.         CVSNT系统中的用户管理原则:

      l         CVSNT的用户与本机(这里是Server机器)上的NT用户是相关联的,即CVSNT用的全是本机上存在的已有用户,因此在默认情况下可以不用设置任何用户名,只要使用本机上已经存在的用户名就可以用WinCVS进行登陆。

      l         只有用Administrator身份登陆到CVSNT系统中,才有权力进行新用户的创建和删除。

      l         使用CVS创建的新用户,必须与服务器端机器上的NT用户相绑定,才能生效;因此,这个新用户实际上是绑定它的NT用户的一个替身,在CVS系统中称为“别名”。

      l         一个NT用户可以有多个‘替身’或‘别名’,充当多个CVS用户。

      10.     WinCVS进行新用户的添加和删除。(确保使用Administrator登陆)

      l         Ctrl+L】或Admin=>Command Line…,弹出Command Line Settings对话框,直接执行CVS命令。

      l         添加新用户【Killer】:cvs passwd -a Killer 回车,设置密码,OK,完成。

      l         绑定【Killer】到【Jackey】:cvs passwd -r Jackey Killer 回车,设置密码,OK,完成。

      l         两次输入的密码可以不同,但以第二次输入的密码为最终密码。

      l         删除用户【Killer】:cvs passwd -X Killer 回车,OK,完成。

      l         其它特殊的功能查看passwd命令的帮助。

      11.     使用完毕后,一定要【Logout】,因为WinCVS退出时并不会自动注销自己在远端的会话;这样做是为了防止其它人接着打开WinCVS,不用登陆就可以完成你能进行的所有操作了。

      6       WinCVS中常见的特殊操作:

      6.1    如何删除下载的文件或目录:

      1.         选中下载的某个或多个文件,执行【Remove】命令。

      2.         再次选中这些文件,执行【Commit】命令就完成了删除文件的操作。

      3.         本质上CVS是不会删除任何文件和目录的,即使是执行了以上操作,删除了某些文件,远端CVS实际执行的是将提交删除的文件放到了一个叫【Attic】的目录下,因此,这些被删除的文件是可以通过一定的方法恢复的。

      6.2    如何恢复已经删除的文件或目录:

      1.         在执行了【Remove】命令之后恢复文件。

      l         Ctrl+L】直接输入命令cvs add xxxxx,或执行【Add Selection】界面操作。

      l         这样就可以直接恢复还未提交的删除文件。

      2.         在执行了【Commit】命令之后恢复文件。

      l         只能用【Ctrl+L】直接输入命令cvs add xxxxx,这时会得到一个空的文件。

      l         选中这个空文件,执行【Update】操作,得到这个文件的实体。

      l         再次选中这个文件,执行【Commit】操作,得到这个文件最新版本。

      3.         由于CVS系统中本质上不会删除任何目录,因此,谈不上对目录的恢复,但是CVS系统默认情况下是要在用户本机上(如:YCW2000

      感谢易载提供各种支持!