| 103 | |
| 104 | == Test 2: Compile MPICH2 sample program and run in multiple compute nodes == |
| 105 | |
| 106 | * Sample program from Wade. |
| 107 | {{{ |
| 108 | |
| 109 | jazz@bio-cluster-12:~$ cat > demo1.c << EOF |
| 110 | > /* Program: |
| 111 | > * 每個 node 將自己的 id 印出,並且將所有的參與運動的 node 總數也印出 |
| 112 | > * ,顯示出自己的主機名稱。 |
| 113 | > * History: |
| 114 | > * 2008-04-09 BETA |
| 115 | > * 2008-06-25 增加顯示主機名稱功能 |
| 116 | > */ |
| 117 | > |
| 118 | > #include <stdio.h> |
| 119 | > #include "mpi.h" |
| 120 | > int main (int argc, char **argv) |
| 121 | > { |
| 122 | > int rank, size, len; |
| 123 | > char name[MPI_MAX_PROCESSOR_NAME]; |
| 124 | > MPI_Init(&argc, &argv); |
| 125 | > int myid, numprocs; |
| 126 | > |
| 127 | > /* 取得 node 總數 */ |
| 128 | > MPI_Comm_size(MPI_COMM_WORLD,&numprocs); |
| 129 | > |
| 130 | > /* 取得本身 node id / rank */ |
| 131 | > MPI_Comm_rank(MPI_COMM_WORLD,&myid); |
| 132 | > |
| 133 | > /* 取得本身 host name */ |
| 134 | > MPI_Get_processor_name(name, &len); |
| 135 | > printf("This is machine %d of %d name = %s\n", myid, numprocs, name); |
| 136 | > MPI_Finalize(); |
| 137 | > } |
| 138 | > EOF |
| 139 | jazz@bio-cluster-12:~$ mpicc -I /usr/include/mpich2/ -lmpich demo1.c -o demo1 |
| 140 | jazz@bio-cluster-12:~$ for i in 11 10 09 08 07 06 |
| 141 | > do |
| 142 | > scp demo1 bio-cluster-$i:. |
| 143 | > done |
| 144 | demo1 100% 557KB 557.3KB/s 00:00 |
| 145 | demo1 100% 557KB 557.3KB/s 00:00 |
| 146 | demo1 100% 557KB 557.3KB/s 00:00 |
| 147 | demo1 100% 557KB 557.3KB/s 00:00 |
| 148 | demo1 100% 557KB 557.3KB/s 00:00 |
| 149 | demo1 100% 557KB 557.3KB/s 00:00 |
| 150 | jazz@bio-cluster-12:~$ mpdboot -n 7 |
| 151 | jazz@bio-cluster-12:~$ mpdtrace -l |
| 152 | bio-cluster-12_41632 (10.220.202.219) |
| 153 | bio-cluster-08_33197 (10.220.202.223) |
| 154 | bio-cluster-09_40371 (10.220.202.222) |
| 155 | bio-cluster-10_54199 (10.220.202.221) |
| 156 | bio-cluster-06_54334 (10.220.202.225) |
| 157 | bio-cluster-07_42302 (10.220.202.224) |
| 158 | bio-cluster-11_36534 (10.220.202.220) |
| 159 | jazz@bio-cluster-12:~$ mpiexec -n 7 /home/jazz/demo1 |
| 160 | This is machine 0 of 7 name = bio-cluster-12 |
| 161 | This is machine 1 of 7 name = bio-cluster-08 |
| 162 | This is machine 2 of 7 name = bio-cluster-09 |
| 163 | This is machine 3 of 7 name = bio-cluster-10 |
| 164 | This is machine 5 of 7 name = bio-cluster-07 |
| 165 | This is machine 6 of 7 name = bio-cluster-11 |
| 166 | This is machine 4 of 7 name = bio-cluster-06 |
| 167 | }}} |
| 168 | |
| 169 | == Test 3: run multiple mpd and R-MPI in multiple compute nodes == |
| 170 | |
| 171 | * Note: mpdboot will use rsh as default communication channel, in debian 4.0 we can find that rsh is equal to ssh. |
| 172 | {{{ |
| 173 | jazz@bio-cluster-12:~$ which rsh |
| 174 | /usr/bin/rsh |
| 175 | jazz@bio-cluster-12:~$ ls -al /usr/bin/rsh |
| 176 | lrwxrwxrwx 1 root root 21 2008-04-09 20:52 /usr/bin/rsh -> /etc/alternatives/rsh |
| 177 | jazz@bio-cluster-12:~$ ls -al /etc/alternatives/rsh |
| 178 | lrwxrwxrwx 1 root root 12 2008-05-29 19:04 /etc/alternatives/rsh -> /usr/bin/ssh |
| 179 | }}} |
| 180 | * |