顯示具有 CLUSTER 標籤的文章。 顯示所有文章
顯示具有 CLUSTER 標籤的文章。 顯示所有文章

2010年6月18日 星期五

MPI 簡述

1. 說明:
MPI 是個標準, 而目前最新版是 MPICH2.

在 MPI1 時, 有 MPICH 與 OPENMPI 前身兩大陣營提供.

而在 MPICH2 時, 由 MPICH2 與 OPENMPI 兩大函式庫提供.


底下用 OPENMPI 說明:

2. 執行過程:
MPIsourecode
|
MPICC
|
mpirun

而 mpirun 能用 qsub 送到底層的 Cluster


3. 範例:
I
hello.c
{{{
#include
#include

int main(int argc, char *argv[]) {
int numprocs, rank, namelen;
char processor_name[MPI_MAX_PROCESSOR_NAME];

MPI_Init(&argc, &argv);
MPI_Comm_size(MPI_COMM_WORLD, &numprocs);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Get_processor_name(processor_name, &namelen);

printf("Process %d on %s out of %d\n", rank, processor_name, numprocs);

MPI_Finalize();
}

}}}

II.
/afs/slac.stanford.edu/package/mpich/bin/mpicc hello.c -o hello

III.
mpirun -np 4 -machinefile machinefile.morab hello
其中 machinefile 是跨 node 才須要, 若一顆是 8 code, 且只要 4 個 process 就不用,
且也是在 cluster 才要 machinefile.







4. 注意:


5. 參考:
MPI

2010年6月17日 星期四

Cluster 說明與環境

1.說明:
Cluster 目前有的是 PBS 為常見

2. 常用指令:
qsub/qsatat 為最常見指令


3. 環境變數:
前置詞為 PBS_ , 而可以看見 Cluster 的

PBS_O_WORKDIR The absolute path of the current working directory of the qsub command.
PBS_NODEFILE The name of the file that contains the list of the nodes assigned to the job.


4. 指令細節:



5. 範例:
test.sh
{{{
#!/bin/bash
#PBS -l nodes=2:ppn=4
#PBS -V

### env var
#module load mpich

cd $PBS_O_WORKDIR

P4_RSHCOMMAND=rsh
NCPUS=`wc -l $PBS_NODEFILE | awk '{print $1}'`

#cat $PBS_NODEFILE > NODES
#cat $PBS_NODEFILE
mpirun -machinefile $PBS_NODEFILE -np $NCPUS $PBS_O_WORKDIR/hello

}}}



6. 注意:
I. 在 home 目錄執行


7. 參考:
Qsub