source: project/mpi/trunk/tests/run.scm @ 7270

Last change on this file since 7270 was 7270, checked in by Ivan Raikov, 13 years ago

Updated to regression tests.

File size: 18.6 KB
Line 
1;;
2;;
3;; Chicken MPI regression test
4;;
5;; Based on the Caml/MPI interface by Xavier Leroy.
6;;
7;; Copyright 2007 Ivan Raikov and the Okinawa Institute of Science and Technology
8;;
9;; This program is free software: you can redistribute it and/or
10;; modify it under the terms of the GNU General Public License as
11;; published by the Free Software Foundation, either version 3 of the
12;; License, or (at your option) any later version.
13;;
14;; This program is distributed in the hope that it will be useful, but
15;; WITHOUT ANY WARRANTY; without even the implied warranty of
16;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17;; General Public License for more details.
18;;
19;; A full copy of the GPL license can be found at
20;; <http://www.gnu.org/licenses/>.
21;;
22
23(require-extension posix)
24(require-extension srfi-4)
25(require-extension mpi)
26
27(define (make-srfi4-vector-map vlen vset! vref)
28  (lambda (v f)
29    (let loop ((v v) (n (- (vlen v) 1)))
30      (if (>= n 0)
31          (let ((x (f (vref v n))))
32            (vset! v n x)
33            (loop v (- n 1)))))))
34         
35(define-macro (define-srfi4-map type)
36  (let ((vlen    (string->symbol (string-append (symbol->string type) "vector-length")))
37        (vref    (string->symbol (string-append (symbol->string type) "vector-ref")))
38        (vset!   (string->symbol (string-append (symbol->string type) "vector-set!")))
39        (name    (string->symbol (string-append (symbol->string type) "vector-map"))))
40  `(define ,name (make-srfi4-vector-map ,vlen ,vset! ,vref))))
41
42(define-srfi4-map u8)
43(define-srfi4-map s8)
44(define-srfi4-map u16)
45(define-srfi4-map s16)
46(define-srfi4-map u32)
47(define-srfi4-map s32)
48(define-srfi4-map f32)
49(define-srfi4-map f64)
50
51(MPI:init)
52
53(define comm-world  (MPI:get-comm-world))
54(define size        (MPI:comm-size comm-world))
55(define myrank      (MPI:comm-rank comm-world))
56
57;; comm_size, comm_rank
58(define (mpi-test)
59
60  (print myrank ": comm_size = " size)
61
62  ;; Barrier
63  (MPI:barrier comm-world)
64 
65  ;; Simple send/receive
66  (if (zero? myrank)
67      (let ((data  (string->blob "aa")))
68        (print myrank ": sending " (blob->string data))
69        (MPI:send data 1 0 comm-world)
70        (let ((n (MPI:receive MPI:any-source MPI:any-tag comm-world)))
71          (print myrank ": received " (blob->string n))))
72      (let* ((n   (MPI:receive MPI:any-source MPI:any-tag comm-world))
73             (n1  (string->blob (string-append (blob->string n) "a"))))
74        (print myrank ": received " (blob->string n) ", resending " (blob->string n1))
75        (MPI:send n1 (modulo (+ myrank 1) size) 0 comm-world)))
76  ;; Barrier
77  (MPI:barrier comm-world)
78 
79  ;; Send and receive with tags
80  (if (zero? myrank)
81      (let ((data1  (string->blob "aa"))
82            (data2  (string->blob "bb")))
83        (print myrank ": sending (tag 0) " data )
84        (MPI:send data1 1 0 comm-world)
85        (print myrank ": sending (tag 1) " data )
86        (MPI:send data2 1 1 comm-world)
87        (let-values (((n src tag)  (MPI:receive-with-status MPI:any-source MPI:any-tag comm-world)))
88          (print myrank ": received " n " (tag " tag ")" " from " src))
89        (let-values (((n src tag)  (MPI:receive-with-status MPI:any-source MPI:any-tag comm-world)))
90          (print myrank ": received " n " (tag " tag ")" " from " src)))
91      (let-values (((n1 src tag1)  (MPI:receive-with-status MPI:any-source 0 comm-world)))
92        (let ((nn1  (string->blob (string-append (blob->string n1) "a"))))
93          (print myrank ": received " n1 " (tag " tag1 ")" " from " src
94                 ", resending " nn1)
95          (let-values (((n2 src tag2)  (MPI:receive-with-status MPI:any-source MPI:any-tag comm-world)))
96            (let ((nn2  (string->blob (string-append (blob->string n2) "b"))))
97              (print myrank ": received " n2 " (tag " tag2 ")" " from " src
98                 ", resending " nn2)
99              (MPI:send nn1 (modulo (+ 1 myrank) size) 1 comm-world))
100            (MPI:send nn2 (modulo (+ 1 myrank) size) 0 comm-world)))))
101  ;; Barrier
102  (MPI:barrier comm-world)
103
104;;   ;; Send and receive base types
105;;   (let ((test-send-recv
106;;       (lambda (sendfun recvfun transf data)
107;;         (if (zero? myrank)
108;;             (begin
109;;               (let loop ((lst data) (i 0))
110;;                 (if (and (not (null? data)) (< i size))
111;;                     (begin
112;;                       (print myrank ": sending " (car data) " to " i)
113;;                       (sendfun (car data) i 0 comm-world)
114;;                       (loop (cdr data) (+ 1 i)))))
115;;               (let loop ((i size))
116;;                 (if (positive? i)
117;;                     (let ((x (recvfun i 0 comm-world)))
118;;                       (print myrank ": received " x)
119;;                       (loop (- i 1))))))
120;;             (let* ((x (recvfun 0 0 comm-world))
121;;                    (y (transf x)))
122;;               (print myrank ": received " x ", sending " y)
123;;               (sendfun y 0 0 comm-world)))))
124;;      )
125;;     (test-send-recv MPI:send-int MPI:receive-int (lambda (x) (+ 1 x))
126;;                  (list 10 20 30 40 50 60 70 80 90))
127;;     (test-send-recv MPI:send-flonum MPI:receive-flonum (lambda (x) (* 2 x))
128;;                  (list 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9))
129;;     (let ((len 3)
130;;        (intdata (list (list 10 11 12) (list 20 21 22) (list 30 31 34) (list 40 41 42)))
131;;        (flodata (list (list 1.1 1.2)  (list 2.1 2.2) (list 3.1 3.2) (list 4.1 4.2)))
132;;        (srfi4-test-send-recv
133;;         (lambda (len vsend vreceive vmap list->vector)
134;;           (lambda (data)
135;;             (test_send_recv vsend (lambda (src tag comm) (vreceive len src tag comm))
136;;                             (lambda (v) (vmap (lambda (x) (+ 1 x)) v))
137;;                             (map list->vector data))))))
138;;       ((srfi4-test-send-recv len MPI:send-u8vector MPI:receive-u8vector u8vector-map list->u8vector)
139;;        intdata)
140;;       ((srfi4-test-send-recv len MPI:send-s8vector MPI:receive-s8vector s8vector-map list->s8vector)
141;;        intdata)
142;;       ((srfi4-test-send-recv len MPI:send-u16vector MPI:receive-u16vector u16vector-map list->u16vector)
143;;        intdata)
144;;       ((srfi4-test-send-recv len MPI:send-s16vector MPI:receive-s16vector s16vector-map list->s16vector)
145;;        intdata)
146;;       ((srfi4-test-send-recv len MPI:send-u32vector MPI:receive-u32vector u32vector-map list->u32vector)
147;;        intdata)
148;;       ((srfi4-test-send-recv len MPI:send-s32vector MPI:receive-s32vector s32vector-map list->s32vector)
149;;        intdata)
150;;       ((srfi4-test-send-recv len MPI:send-f32vector MPI:receive-f32vector f32vector-map list->f32vector)
151;;        flodata)
152;;       ((srfi4-test-send-recv len MPI:send-f64vector MPI:receive-f64vector f64vector-map list->f64vector)
153;;        flodata)))
154
155;;   ;; Barrier
156;;   (MPI:barrier comm-world)
157
158;;   (if (positive? myrank)
159;;       (sleep myrank))
160;;   (print myrank ": hitting barrier")
161;;   (MPI:barrier comm-world)
162;;   (if (zero? myrank)
163;;       (print "jumped barrier"))
164
165;;   ;;  Broadcast
166;;   (let* ((test-broadcast
167;;       (lambda (bcast data)
168;;         (if (zero? myrank)
169;;             (print myrank ": broadcasting " data))
170;;         (let ((res (bcast data 0 comm-world)))
171;;           (print myrank ": received " res)))))
172;;     (test-broadcast MPI:broadcast-bytevector (string->blob "Hello!"))
173;;     (test-broadcast MPI:broadcast-int 123456)
174;;     (test-broadcast MPI:broadcast-flonum 3.141592654)
175;;     (let ((intdata  (list 12 45 78))
176;;        (flodata  (list 3.14 2.718 0.578))
177;;        (srfi4-test-broadcast
178;;         (lambda (bcast list->vector data)
179;;           (test-broadcast bcast (list->vector data)))))
180;;       (test-broadcast MPI:broadcast-s8vector list->s8vector intdata)
181;;       (test-broadcast MPI:broadcast-u8vector list->u8vector intdata)
182;;       (test-broadcast MPI:broadcast-s16vector list->s16vector intdata)
183;;       (test-broadcast MPI:broadcast-u16vector list->u16vector intdata)
184;;       (test-broadcast MPI:broadcast-s32vector list->s32vector intdata)
185;;       (test-broadcast MPI:broadcast-u32vector list->u32vector intdata)
186;;       (test-broadcast MPI:broadcast-f32vector list->f32vector flodata)
187;;       (test-broadcast MPI:broadcast-f64vector list->f64vector flodata)))
188
189;;   ;; Barrier
190;;   (MPI:barrier comm-world)
191
192;;   ;; Scatter
193;;   (let* ((test-scatter
194;;       (lambda (scatter data)
195;;         (if (zero? myrank)
196;;             (print myrank ": scattering " data))
197;;         (let ((res (scatter data 3 0 comm-world)))
198;;           (print myrank ": received " res))
199;;         (MPI:barrier comm-world))))
200;;     (test-scatter MPI:scatter-bytevector (string->blob "aaabbbcccdddeee"))
201;;     (test-scatter MPI:scatter-int (s32vector 12 34 56 78 90))
202;;     (test-scatter MPI:scatter-flonum (s32vector 1.2 3.4 5.6 7.8 9.1))
203;;     (let ((intdata  (list 10 10 10 20 20 20 30 30 30 40 40 40 50 50 50))
204;;        (flodata  (list 1.2 1.2 1.2 3.4 3.4 3.4 3.4 4.5 4.5 4.5 6.7 6.7 6.7))
205;;        (srfi4-test-scatter
206;;         (lambda (scatter list->vector data)
207;;           (test-scatter scatter (list->vector data)))))
208;;       (test-scatter MPI:scatter-s8vector list->s8vector intdata)
209;;       (test-scatter MPI:scatter-u8vector list->u8vector intdata)
210;;       (test-scatter MPI:scatter-s16vector list->s16vector intdata)
211;;       (test-scatter MPI:scatter-u16vector list->u16vector intdata)
212;;       (test-scatter MPI:scatter-s32vector list->s32vector intdata)
213;;       (test-scatter MPI:scatter-u32vector list->u32vector intdata)
214;;       (test-scatter MPI:scatter-f32vector list->f32vector flodata)
215;;       (test-scatter MPI:scatter-f64vector list->f64vector flodata)))
216     
217;;   ;; Gather
218;;   (let* ((test-gather
219;;       (lambda (gather data)
220;;         (print myrank ": sending " data)
221;;         (let ((res (gather data 3 0 comm-world)))
222;;           (if (zero? myrank)
223;;               (print myrank ": gathered " res))
224;;           (MPI:barrier comm-world)))))
225;;     (test-gather MPI:gather-bytevector
226;;               (list-ref (map string->blob (list "aaa" "bbb" "ccc" "ddd" "eee")) myrank))
227;;     (test-gather MPI:gather-int
228;;               (list-ref (list 12 34 56 78 90) myrank))
229;;     (test-gather MPI:gather-flonum
230;;               (list-ref (list 1.2 3.4 5.6 7.8 9.0) myrank))
231;;     (test-gather MPI:gather-s8vector
232;;               (s8vector (* 10 myrank) (+ 1 (* 10 myrank)) (+ 2 (* 10 myrank))))
233;;     (test-gather MPI:gather-u8vector
234;;               (u8vector (* 10 myrank) (+ 1 (* 10 myrank)) (+ 2 (* 10 myrank))))
235;;     (test-gather MPI:gather-s16vector
236;;               (s16vector (* 10 myrank) (+ 1 (* 10 myrank)) (+ 2 (* 10 myrank))))
237;;     (test-gather MPI:gather-u16vector
238;;               (u16vector (* 10 myrank) (+ 1 (* 10 myrank)) (+ 2 (* 10 myrank))))
239;;     (test-gather MPI:gather-s32vector
240;;               (s32vector (* 10 myrank) (+ 1 (* 10 myrank)) (+ 2 (* 10 myrank))))
241;;     (test-gather MPI:gather-u32vector
242;;               (u32vector (* 10 myrank) (+ 1 (* 10 myrank)) (+ 2 (* 10 myrank))))
243;;     (test-gather MPI:gather-f32vector
244;;               (f32vector (* 10 myrank) (+ 0.1 (* 10 myrank)) (+ 0.2 (* 10 myrank))))
245;;     (test-gather MPI:gather-f64vector
246;;               (f64vector (* 10 myrank) (+ 0.1 (* 10 myrank)) (+ 0.2 (* 10 myrank)))))
247
248
249;;   ;; Gather to all
250;;   (let* ((test-allgather
251;;       (lambda (allgather data)
252;;         (print myrank ": sending " data)
253;;         (let ((res (allgather data 0 comm-world)))
254;;           (print myrank ": gathered " res)
255;;           (MPI:barrier comm-world)))))
256;;     (test-allgather MPI:allgather-bytevector
257;;                  (list-ref (map string->blob (list "aaa" "bbb" "ccc" "ddd" "eee")) myrank))
258;;     (test-allgather MPI:allgather-int
259;;                  (list-ref (list 12 34 56 78 90) myrank))
260;;     (test-allgather MPI:allgather-flonum
261;;                  (list-ref (list 1.2 3.4 5.6 7.8 9.0) myrank))
262;;     (test-allgather MPI:allgather-s8vector
263;;                  (s8vector (* 10 myrank) (+ 1 (* 10 myrank)) (+ 2 (* 10 myrank))))
264;;     (test-allgather MPI:allgather-u8vector
265;;                  (u8vector (* 10 myrank) (+ 1 (* 10 myrank)) (+ 2 (* 10 myrank))))
266;;     (test-allgather MPI:allgather-s16vector
267;;                  (s16vector (* 10 myrank) (+ 1 (* 10 myrank)) (+ 2 (* 10 myrank))))
268;;     (test-allgather MPI:allgather-u16vector
269;;                  (u16vector (* 10 myrank) (+ 1 (* 10 myrank)) (+ 2 (* 10 myrank))))
270;;     (test-allgather MPI:allgather-s32vector
271;;                  (s32vector (* 10 myrank) (+ 1 (* 10 myrank)) (+ 2 (* 10 myrank))))
272;;     (test-allgather MPI:allgather-u32vector
273;;                  (u32vector (* 10 myrank) (+ 1 (* 10 myrank)) (+ 2 (* 10 myrank))))
274;;     (test-allgather MPI:allgather-f32vector
275;;                  (f32vector (* 10 myrank) (+ 0.1 (* 10 myrank)) (+ 0.2 (* 10 myrank))))
276;;     (test-allgather MPI:allgather-f64vector
277;;                  (f64vector (* 10 myrank) (+ 0.1 (* 10 myrank)) (+ 0.2 (* 10 myrank)))))
278
279
280;;   ;; Reduce
281
282;;   (let* ((test-reduce
283;;        (lambda (reducefun reduceops data)
284;;          (for-each (lambda (op)
285;;                      (let ((res (reducefun data op 0 comm-world)))
286;;                        (if (zero? myrank)
287;;                            (print myrank ": the result of reduction " op " is " res))))
288;;                    reduceops)
289;;          (MPI:barrier comm-world))))
290;;     (test-reduce MPI:reduce-int
291;;               (list MPI:i_max MPI:i_min MPI:i_sum MPI:i_prod
292;;                     MPI:i_land MPI:i_lor MPI:i_xor)
293;;               (+ 1 myrank))
294;;     (test-reduce MPI:reduce-flonum
295;;               (list MPI:f_max MPI:f_min MPI:f_sum MPI:f_prod )
296;;               (+ 0.1 myrank))
297;;     (test-reduce MPI:reduce-s8vector
298;;               (list MPI:i_max MPI:i_min MPI:i_sum MPI:i_prod
299;;                     MPI:i_land MPI:i_lor MPI:i_xor)
300;;               (s8vector (* 2 myrank) (+ 1 (* 2 myrank)) (+ 2 (* 2 myrank))))
301;;     (test-reduce MPI:reduce-u8vector
302;;               (list MPI:i_max MPI:i_min MPI:i_sum MPI:i_prod
303;;                     MPI:i_land MPI:i_lor MPI:i_xor)
304;;               (u8vector (* 2 myrank) (+ 1 (* 2 myrank)) (+ 2 (* 2 myrank))))
305;;     (test-reduce MPI:reduce-s16vector
306;;               (list MPI:i_max MPI:i_min MPI:i_sum MPI:i_prod
307;;                     MPI:i_land MPI:i_lor MPI:i_xor)
308;;               (s16vector (* 2 myrank) (+ 1 (* 2 myrank)) (+ 2 (* 2 myrank))))
309;;     (test-reduce MPI:reduce-u16vector
310;;               (list MPI:i_max MPI:i_min MPI:i_sum MPI:i_prod
311;;                     MPI:i_land MPI:i_lor MPI:i_xor)
312;;               (u16vector (* 2 myrank) (+ 1 (* 2 myrank)) (+ 2 (* 2 myrank))))
313;;     (test-reduce MPI:reduce-s32vector
314;;               (list MPI:i_max MPI:i_min MPI:i_sum MPI:i_prod
315;;                     MPI:i_land MPI:i_lor MPI:i_xor)
316;;               (s32vector (* 2 myrank) (+ 1 (* 2 myrank)) (+ 2 (* 2 myrank))))
317;;     (test-reduce MPI:reduce-u32vector
318;;               (list MPI:i_max MPI:i_min MPI:i_sum MPI:i_prod
319;;                     MPI:i_land MPI:i_lor MPI:i_xor)
320;;               (u32vector (* 2 myrank) (+ 1 (* 2 myrank)) (+ 2 (* 2 myrank))))
321;;     (test-reduce MPI:reduce-f32vector
322;;               (list MPI:f_max MPI:f_min MPI:f_sum MPI:f_prod )
323;;               (f32vector (* 2 myrank) (+ 0.1 (* 2 myrank)) (+ 0.2 (* 2 myrank))))
324;;     (test-reduce MPI:reduce-f64vector
325;;               (list MPI:f_max MPI:f_min MPI:f_sum MPI:f_prod )
326;;               (f64vector (* 2 myrank) (+ 0.1 (* 2 myrank)) (+ 0.2 (* 2 myrank)))))
327
328;;   ;; Reduce all
329;;   (let* ((test-allreduce
330;;        (lambda (allreducefun reduceop data)
331;;          (print myrank ": data is " data)
332;;          (let ((res (allreducefun data reduceop comm-world)))
333;;            (MPI:barrier comm-world)
334;;            (print myrank ": the result of reduction " op " is " res)
335;;            (MPI:barrier comm-world)))))
336;;     (test-allreduce MPI:allreduce-int MPI:i_sum (+ 1 myrank))
337;;     (test-allreduce MPI:allreduce-flonum MPI:f_prod (+ 1.0 myrank))
338;;     (test-reduce MPI:allreduce-s8vector MPI:i_sum
339;;               (s8vector (* 2 myrank) (+ 1 (* 2 myrank)) (+ 2 (* 2 myrank))))
340;;     (test-allreduce MPI:allreduce-u8vector MPI:i_sum
341;;                  (u8vector (* 2 myrank) (+ 1 (* 2 myrank)) (+ 2 (* 2 myrank))))
342;;     (test-allreduce MPI:allreduce-s16vector MPI:i_sum
343;;                  (s16vector (* 2 myrank) (+ 1 (* 2 myrank)) (+ 2 (* 2 myrank))))
344;;     (test-allreduce MPI:allreduce-u16vector MPI:i_sum
345;;                  (u16vector (* 2 myrank) (+ 1 (* 2 myrank)) (+ 2 (* 2 myrank))))
346;;     (test-allreduce MPI:allreduce-s32vector MPI:i_sum
347;;                  (s32vector (* 2 myrank) (+ 1 (* 2 myrank)) (+ 2 (* 2 myrank))))
348;;     (test-allreduce MPI:allreduce-u32vector MPI:i_sum
349;;                  (u32vector (* 2 myrank) (+ 1 (* 2 myrank)) (+ 2 (* 2 myrank))))
350;;     (test-allreduce MPI:allreduce-f32vector MPI:f_sum 
351;;                  (f32vector (* 2 myrank) (+ 0.1 (* 2 myrank)) (+ 0.2 (* 2 myrank))))
352;;     (test-allreduce MPI:allreduce-f64vector MPI:f_sum 
353;;                  (f64vector (* 2 myrank) (+ 0.1 (* 2 myrank)) (+ 0.2 (* 2 myrank)))))
354   
355;;   ;; Scan
356;;   (let* ((test-scan
357;;        (lambda (scanfun reduceop data)
358;;          (print myrank ": data is " data)
359;;          (let ((res (scanfun data reduceop comm-world)))
360;;            (MPI:barrier comm-world)
361;;            (print myrank ": the result of scan " op " is " res)
362;;            (MPI:barrier comm-world)))))
363;;     (test-scan MPI:scan-int MPI:i_sum (+ 1 myrank))
364;;     (test-scan MPI:scan-flonum MPI:f_prod (+ 1.0 myrank))
365;;     (test-reduce MPI:scan-s8vector MPI:i_sum
366;;               (s8vector (* 2 myrank) (+ 1 (* 2 myrank)) (+ 2 (* 2 myrank))))
367;;     (test-scan MPI:scan-u8vector MPI:i_sum
368;;             (u8vector (* 2 myrank) (+ 1 (* 2 myrank)) (+ 2 (* 2 myrank))))
369;;     (test-scan MPI:scan-s16vector MPI:i_sum
370;;             (s16vector (* 2 myrank) (+ 1 (* 2 myrank)) (+ 2 (* 2 myrank))))
371;;     (test-scan MPI:scan-u16vector MPI:i_sum
372;;             (u16vector (* 2 myrank) (+ 1 (* 2 myrank)) (+ 2 (* 2 myrank))))
373;;     (test-scan MPI:scan-s32vector MPI:i_sum
374;;             (s32vector (* 2 myrank) (+ 1 (* 2 myrank)) (+ 2 (* 2 myrank))))
375;;     (test-scan MPI:scan-u32vector MPI:i_sum
376;;             (u32vector (* 2 myrank) (+ 1 (* 2 myrank)) (+ 2 (* 2 myrank))))
377;;     (test-scan MPI:scan-f32vector MPI:f_sum 
378;;             (f32vector (* 2 myrank) (+ 0.1 (* 2 myrank)) (+ 0.2 (* 2 myrank))))
379;;     (test-scan MPI:scan-f64vector MPI:f_sum 
380;;             (f64vector (* 2 myrank) (+ 0.1 (* 2 myrank)) (+ 0.2 (* 2 myrank)))))
381
382;;   ;; Comm split
383;;   (let ((send-in-comm
384;;       (lambda (c init incr)
385;;         (let ((rank-in-c (MPI:comm-rank c))
386;;               (size-of-c (MPI:comm-size c)))
387;;           (if (zero? rank-in-c)
388;;               (begin
389;;                 (print rank-in-c "[" myrank "]: sending " init)
390;;                 (MPI:send init 1 0 c)
391;;                 (let ((n (MPI:receive-bytevector MPI:any-source MPI:any-tag c)))
392;;                   (print rank-in-c "[" myrank "]: received " n)))
393;;               (let ((n (MPI:receive-bytevector MPI:any-source MPI:any-tag c)))
394;;                 (let ((n1 (string->blob (string-append (blob->string n) incr))))
395;;                   (print rank-in-c "[" myrank "]: received " n ", resending " n1)
396;;                   (MPI:send n1 (modulo (+ 1 rank-in-c) size-of-c) 0 c))))))))
397;;     (let ((c (MPI:comm-split comm-world (modulo myrank 2) 0)))
398;;       (if (zero? (modulo myrank 2))
399;;        (send-in-comm c (string->blob "aa") "a")
400;;        (send-in-comm c (string->blob "bb") "b"))
401;;       (MPI:barrier comm-world)))
402
403;;   ;; Cartesian topology
404;;   (let ((cart (MPI:make-cart comm-world (u32vector 2 2) (u32vector 0 0) #t))
405;;      (test-dims-create
406;;       (lambda (n hints)
407;;         (print "make-dims " n " " hints " = " (MPI:make-dims n hints)))))
408;;     (if (zero? myrank)
409;;      (begin
410;;        (print "ranks = " (map (lambda (x) (cons x (MPI:cart-rank cart x)))
411;;                               (u32vector 0 0) (u32vector 1 0)
412;;                               (u32vector 1 0) (u32vector 1 1)))
413;;        (print "coords = " (list-tabulate (MPI:comm-size cart)
414;;                               (lambda (n) (cons n (MPI:cart-coords cart n)))))
415;;        (test-dims-create 60 (u32vector 0 0 0))
416;;        (test-dims-create 60 (u32vector 3 0 0))
417;;        (test-dims-create 60 (u32vector 0 4 0))
418;;        (test-dims-create 60 (u32vector 3 0 5))
419;;        (MPI:barrier comm-world))))
420
421;;   ;; Wtime
422;;   (print myrank ": wtime is "  (MPI:wtime))
423;;   )
424         
425  )
426                                 
427
428
429(mpi-test)
430
Note: See TracBrowser for help on using the repository browser.