Wednesday, May 9, 2007

Apple-Xgrid邮件列表上关于环境变量的讨论

I am hoping someone can point me in the right direction. Recently I set up a cluster of 6 XServe nodes. I am trying to perform a series of Monte Carlo simulations on the cluster, submitting the jobs via Xgrid (and am rather new at using Xgrid). The code requires certain user defined environment variables to be set at run time. I actually set these manually within the /etc/profile and etc/bashrc on each node. The executable I am trying to run was compiled with g++ 3.3 and takes a series of values at the command line as input. Every time I submit the code throws an exception saying that an environment variable is not set. I am at a loss of what to do.
 
Recently I began using GridStuffer for job submission. In an attempt to bypass the environment variable problem I wrote a simple shell script which first sets the variable and then calls the program with the command line input. Here it is:
 
----------------------
#!/bin/sh
 
export $G4LEDATA=/usr/local/Geant4.7.0/DataFiles/G4EMLOW2.3
 
echo $G4LEDATA
 
./proton true true false ICRU-49p false false monoenergetic pencil 400 400.0 154.0 150.0 0.0 30.0 20.0 water water 1.0 1.0 1000
----------------------
 
The name of the script is then listed in the first and only line of a text file that I use as input to GridStuffer.  I do indeed get the variable $G4LEDATA send to stdout, but the program will not run beyond a certain point. There is nothing written to stderr. If I don't set $G4LEDATA, the exception I mentioned above is sent to stderr.
 
Another thing I tried was to copy the executable (proton) to each node, all in the same directory. Then in the script I have /directory/proton true true .....
instead of ./proton true true.... However, as far as I can tell the program never executes.
 
My apologies for being rather verbose, but I am really stuck at this point. I openly acknowledge my lack of knowledge with Xgrid and GridStuffer, and think that the problem is in my not fully understanding how either really works. I have completely turned off the all password authentification between the controller and agents since the cluster is not online (completely stand-alone). A couple of questions :
 
(1) How does the controller log into the agent to transfer files? I am assuming it is as a generic user. Shouldn't the user have full access to environment variables defined in /etc/profile? 
(2) With GridStuffer, is there a better way than what I am doing to submit the job? For instance, using the directives -dirs and -files to force certain files to be copied to the agent?
 
Any help will be greatly appreciated.
 
P.S. Charles, I hope you see this because your help would be very beneficial..
 
Thanks,
 
Dan
 
--------
 
 
Dr. Dan J. Fry
Physicist
Henry M. Jackson Foundation For The Advancement of Military Medicine
Walter Reed Army Medical Center
6900 Georgia Avenue, NW
Washington, DC 20307

I did some testing with environment variables to make sure, but it seems quite certain that Xgrid will not load environment variables, or more precisely the shell won't, even if explicitely called using / bin/sh somewhere in the text. This is not too surprising.

The shell script approach you propose should work better for this purpose. If you really need to set up the environment from the information specific for the agent, you might alternatively read /etc/ profile manually to load the env var there in your script (not sure how to do that _exactly_).

Now, it seems your program still won't run "beyond a certain point" within the script. What exactly happens then? Your program only need to have $G4LEDATA? Or is another env var missing? Look for messages in the agent Console. Anyway, I would definitely go ahead with the script wrapping approach and iron out the other problems then, which might be different.

Regarding the GridStuffer format, you only need -files to explicitely force the addition of a file to the job (and you probably don't need - dirs). If 'proton' is in the same path as the input file, and if you don't need any other files to run the program, then you are fine, no - files needed, GridStuffer will figure it out. If you can have everything set up on the agent, even better, then use only full paths for the program and files in the job submission.

Finally, Xgrid agent will usually run as user 'nobody' (unless you are using Kerberos auth or you manually start the agent as a different user).

hope that helps,

charles

需要在每个Xgrid的Agent上安装Gate

From Apple's Xgrid mailing list:

1.

Question:

Is it possible NOT to duplicate the whole environment (binaries, libraries, etc...), and just send the input files? In other words, is it possible to have the executable already on the agents (as we have), and just the input files on the controller?

Answer:

Yes. The simplest way to do this is to pre-install the executables, and simply use a shell-script which invokes them as the 'command'

2.

One thing about the darwin ports version, it builds povray using shared libraries, which means that when you run that version of povray, it looks in /usr/lib (or /opt/usr/lib--I don't remember) to find the required libraries (libpng for example). That means you have to pre install those libraries on all of the agent computers, which can be a problem if you don't have direct control over the agents. Anton Raves' compile instructions doesn't use shared libraries, but copies them into the executable (which makes the executable larger, but it makes it run better on the agents).

3.

For example, using Xgrid to run thousands of iterations of a Monte Carlo is a really good idea.  The trick is that you either need a stand-along program for the computation, or you need your 
computational environment (Mathematica, Matlab, etc.) pre-installed on every agent machine.

网上xgrid教程

The Xgrid Tutorials (Part I): Xgrid Basics


http://www.macresearch.org/the_xgrid_tutorials_part_i_xgrid_basics

Tuesday, May 8, 2007

把自己的Mac OS X设成Xgrid Controller

目的是看看能否运行Gate...

运行 sudo xgridctl c start

然后在Xgrid Admin里可以看到新的controller,但是无法添加,可能是密码不对,但是不知道在哪里设置密码。

换一个办法:XgridLite

安装后在system preferences的other下面多了一个xgridlite,可以对controller进行控制和密码设置。。。

Xserve for Cluster Node的说明书

本地下载:XserveClusterNodeQuickStart.pdf

Monday, May 7, 2007

【转载】Xgrid简化网格部署

Xgrid简化网格部署

■ 赵永华 http://www2.ccw.com.cn/04/0415/b/0415b04_6.asp


把分布在世界各地的计算机连接起来,形成一个大规模的网格以满足科学计算和商业应用的需求,这就是苹果公司新推出的Xgrid要解决的问题。虽然在网格计算领域,Xgrid似乎是姗姗来迟,但它带来的灵活性、易用性和适应性却给网格计算用户提供了一种新选择。

在今年的MACWORLD EXPO 2004展会上, 苹果公司先进计算小组ACG(Advanced Computation Group)展示了基于网格的集群技术——Xgrid。据报道,Xgrid可以为科研人员提供一种具备精深计算能力的虚拟环境,利用苹果公司的 Rendezvous网络技术将多台Mac机连接起来,从而充分利用包括桌面PC和服务器在内的IT资源。

基础架构

那么Xgrid究竟是什么呢?

简单地说,Xgrid是一组Mac OS X应用套件,它使管理人员可以将本地和远程计算机连接起来形成网格,从而使本地和远程用户可以随时使用整个网格提供的计算资源。当用户将一项工作(Job)提交给系统后,Xgrid将为每项工作创建多个任务(Task)并且将它们分配给网格上的多个节点去并行地执行。Xgrid产生的目的是为了解决复杂耗时的计算问题,诸如蒙特卡洛计算、3D渲染等。然而,Xgrid本身并不是一种计算方法,它是一种让多台计算机相互“交谈”的网格结构。

Xgrid允许一个程序在不同的机器上并行运行,从而迅速得到运行结果。在Xgrid中包括三大软件组件:用于启动运算例程的客户机(Client)、进行初始化计算的控制机(Controller)以及执行计算过程的代理机(Agent)(图)。

● 客户机 Xgrid用户通过Xgrid客户机应用向集群服务器提交工作(Job)并设定该项工作在Xgrid客户机上执行时的参数,然后把工作提交给控制机。但工作完成后,客户机将接到通知并从控制机上获得执行的结果。

● 控制机 Xgrid控制服务(GridServer流程)管理集群通信和资源,它接受客户机提交的工作,将它分成多个任务并分别提交给不同的代理机执行,然后将执行结果返回给客户机。

● 代理机 代理机的作用很简单,就是负责运行控制机分配的任务。代理机一次只能与一台控制机连接,接受该控制机发送的命令和数据,并将任务执行的结果返回给控制机。

在Xgrid系统中,任何一台机器都可以安装客户机、控制机和代理机,因此,系统中的任何一台机器都可以担任某一种角色或多种角色。

从硬件上看,Xgrid就像是一簇由Mac机器组成的超级计算机;从软件看,它所采用的Rendezvous软件代理可以对Mac集群中的各子系统任务进行自动查找、链接和管理。在实际的演示中,Xgrid运行的演示服务器是基于42U工业构架的Xserve G5,它是一个由84个Power PC G5处理器组成的集群系统,具有1.5Teraflops处理能力。

运行模式

Xgrid的管理方式很简洁,其控制台具有直观的Aqua界面便于执行各种操作命令,包括语法类似Unix的命令行、Shell脚本和应用例程。据悉,美国的多家公司和机构已经对Xgrid进行了多种测试,包括桌面、移动和网络功能。Simon Fraser大学的一个数学研究小组已采用了数据处理能力超过30GHz的Xgrid系统去尝试解决名为“弱型自相关二进制序列”中的多项难题。隶属于美国国家航空航天局(NASA)的弗吉尼亚州汉普顿市兰利研究中心也在试用Xgrid,其课题项目为FORTRAN代码编写的喷气式噪音模型Jet3D,该系统由Power Mac G5、 Power Mac G4 和 Xserve G4簇连,在运算时共计有8个G4处理器和2个G5执行,总性能指标接近32Gigaflops。

Xgrid集群软件调动的是整个网络的处理能力而非所有CPU的潜力,它提供了远程执行和文件分段传输方式,以同等方式运行分散的计算资源,从而确保每台机器无论用户还是开发人员都能够访问到执行任务时所有必要的文件。Xgrid提供的Rendezvous零配置方式可以查找到有效资源,不需要输入IP地址设置集群,System Preference控制面板可以让用户控制本地机被网络调度的方式。在集群中加入的Mac机越多,程序运行就越快捷。比如,当你用一组Mac机绘制复杂的图形时就会看到资源共享所具有的威力。

但是,犹如春天里尚未成熟的果实,正在成长中的Xgrid不可能使所有的集群问题迎刃而解。比如,它不能替代 MPI(Message Passing Interface)类型的集群软件,MPI一直是并行计算的学术标准,它将一个计算项目分解成多个子项,然后将各项计算结果收集汇总;而Xgrid是通过代理方式去执行一项任务。MPI也被用来作为编写便携式并行应用的API,而Xgrid经常是通过Mac OS X应用进行分布式计算的前后台应用程序。由于Xgrid采用的是XML开放式协议,所以它目前尚不能用于Unix系统和集群硬件InfiniBand。 Xgrid也不能将已经存在的软件“网格化”,甚至无法实现“提速”。如果要让传统应用具有Xgrid技术优势,必须通过Xgrid API改造内核。毕竟,Xgrid提供的是一种用最少的开发代价换取高吞吐海量计算的方法。

Xgrid的优势

虽然还存在许多不足,但与其他一些网格解决方案相比,Xgrid还是具有独特的优势。首先,Xgrid对所支持的计算机数量没有任何限制,网格的性能取决于参与系统的机器、运行的软件、网络等因素,当网格的建立和算法实现符合并行、松耦合等条件时,M台运行 Xgrid、速率为1GHz计算机组成的网格其性能将接近MGHz。

在Xgrid出现之前,已经有一些网格项目在成功地运行,比如主要针对科学计算的Seti@Home和 FightAids@home。它们通常提供了一个非常容易安装的软件包,使任何用户都可以方便地加入到该项目中,这些网格项目可以利用系统中计算机的空闲时间进行科学计算。不过,你不必担心从哪里去寻找如此海量的空闲计算机,事实上,很多机构和个人的计算机都有足够的空闲时间。例如,大学计算中心里的机器在工作时间里很繁忙,但在夜里和周末,绝大部分机器处于空闲状态,此时,这些空闲的计算能力就能被网格充分利用。

还有一些网格项目并不针对特定的应用,而是提供了更加灵活的资源管理工具和更智能化的网格部署方法,例如 Globus Alliance。这类项目实际上提供了一种网格计算基础框架。Xgrid允许用户方便地安装客户机以参与到他们所选定的计算网格中,就像在 Seti@Home模式中所做的那样;同时,Xgrid也为网格开发人员提供了更加灵活的基础架构使他们能方便地部署其应用,这一点很像Globus Alliance的模式。这种结合使Xgrid具有两类网格项目的优势,其中最主要的优势包括以下一些:

● 易于配置 与其他企业集群解决方案相比,Xgrid的建立要容易得多;

● 易于使用 不要求客户机采用命令行模式(当然,如果你愿意,你仍然可以使用命令行;将软件、数据分布、任务执行等操作的复杂性隐藏起来;利用Rendezvous自动发现系统中的Xgrid控制器;

● 广泛的适应性 可以支持所有网格计算需求,而不仅仅支持生物信息学、流体力学或其他科学计算。

正如一个人具有天才气质那样,苹果一直是计算机领域的阳春白雪。一个人也许一生无缘触摸华贵的Mac,但他所操作的IT工具却往往弥留着苹果的果香。是苹果在1970年代以Apple II点燃了个人电脑的技术之火,10年后又以Mac让个人电脑变成优雅的艺术杰作。那么,Xgrid究竟会不会将PC变成超级计算机?笔者将拭目以待。

(计算机世界报 第15期 B16)

[转载]Xgrid技术让Macintosh变身超级电脑

天极网5月20日消息 苹果电脑今日发表由高端运算事业群(Advanced Computation Group,ACG)所研发的「Xgrid」丛集运算技术,此项技术可运用在科学领域,或是需要大量运算的工作环境。

  Xgrid能利用电脑中闲置的运算资源来处理大型批次工作或是需要大量运算的工作。Xgrid程序现已在苹果电脑网站(http://www.apple.com/acg/xgrid)提供免费下载。Xgrid也是苹果电脑在方便易用(Ease of Use)观念上的最佳实践。只要利用几台Macintosh电脑,透过Rendezvous网络技术,便能执行密集且复杂的运算工作,如基因排序(BLAST)等。

  苹果指出:“Xgrid可以让你的Macintosh丛集成为功能强大的超级电脑,新的Xgrid软件运用了Rendezvous网络技术,能够自动搜寻、连接及管理丛集中各系统所执行的工作。”

  Xgrid也能在新推出的Xserve G5服务器上执行,若采用业界标准的42U机架,就能建置高达84颗Power PC G5处理器之丛集,其效能相当于一个拥有1.5 teraflop (1 teraflop = 1,024 gigaflop)运算能力的超级电脑,能协助解决需要密集运算的问题。

  此外,Xgrid在管理上极为简单:Xgrid控制台拥有直觉式的Aqua界面设计,可以轻松执行UNIX指令、shell script,或是将应用程序分散在丛集内执行。Xgrid内建基因排序应用软件(BLAST),且内含一组软件开发工具,让特别需要密集运算的应用程序能够轻易的移植到Xgrid架构。

  在NASA、Genentech、Simon Fraser大学、Reed学院,还有维吉尼亚理工大学等单位,都曾利用Macintosh桌上型电脑、笔记型电脑或服务器测试过这项新技术。其中 Simon Fraser大学数学系研究员Peter Borwein博士利用Xgrid解决有关搜寻 “低自动相关二元序列”(low autocorrelation binary sequences)的相关问题。此研究小组在Xgrid的协助下,将研究室的电脑集结起来,创造出一个拥有30 GHz运算能力的数据处理系统。

  NASA位于维吉尼亚州的Langley研究中心,也曾将Xgrid应用于FORTRAN程序语言的喷射引擎噪音预测的实验上。这个名为Jet3D实验之丛集,共享了8个G4以及两个G5处理器(包括 Power Mac G5、Power Mac G4与Xserve G4),获得了高达32 gigaflop的惊人运算性能。(完)