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

Last change on this file since 7269 was 7269, checked in by Ivan Raikov, 12 years ago

Moved test.scm to tests/run.scm

File size: 18.7 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
80(mpi-test)
81
82 
83;;   ;; Send and receive with tags
84;;   (if (zero? myrank)
85;;       (let ((data1  (string->blob "aa"))
86;;          (data2  (string->blob "bb")))
87;;      (print myrank ": sending (tag 0) " data )
88;;      (MPI:send data1 1 0 comm-world)
89;;      (print myrank ": sending (tag 1) " data )
90;;      (MPI:send data2 1 1 comm-world)
91;;      (let-values (((n src tag)  (MPI:receive-status MPI:any-source MPI:any-tag comm-world)))
92;;        (print myrank ": received " n " (tag " tag ")" " from " src))
93;;      (let-values (((n src tag)  (MPI:receive-status MPI:any-source MPI:any-tag comm-world)))
94;;        (print myrank ": received " n " (tag " tag ")" " from " src)))
95;;       (let-values (((n1 src tag1)  (MPI:receive-status MPI:any-source 0 comm-world)))
96;;         (let ((nn1  (string->blob (string-append (blob->string n1) "a"))))
97;;           (print myrank ": received " n1 " (tag " tag1 ")" " from " src
98;;               ", resending " nn1)
99;;        (let-values (((n2 src tag2)  (MPI:receive-status MPI:any-source MPI:any-tag comm-world)))
100;;          (let ((nn2  (string->blob (string-append (blob->string n2) "b"))))
101;;            (print myrank ": received " n2 " (tag " tag2 ")" " from " src
102;;               ", resending " nn2)
103;;            (MPI:send nn1 (modulo (+ 1 myrank) size) 1 comm-world))
104;;            (MPI:send nn2 (modulo (+ 1 myrank) size) 0 comm-world)))))
105;;   ;; Barrier
106;;   (MPI:barrier comm-world)
107
108;;   ;; Send and receive base types
109;;   (let ((test-send-recv
110;;       (lambda (sendfun recvfun transf data)
111;;         (if (zero? myrank)
112;;             (begin
113;;               (let loop ((lst data) (i 0))
114;;                 (if (and (not (null? data)) (< i size))
115;;                     (begin
116;;                       (print myrank ": sending " (car data) " to " i)
117;;                       (sendfun (car data) i 0 comm-world)
118;;                       (loop (cdr data) (+ 1 i)))))
119;;               (let loop ((i size))
120;;                 (if (positive? i)
121;;                     (let ((x (recvfun i 0 comm-world)))
122;;                       (print myrank ": received " x)
123;;                       (loop (- i 1))))))
124;;             (let* ((x (recvfun 0 0 comm-world))
125;;                    (y (transf x)))
126;;               (print myrank ": received " x ", sending " y)
127;;               (sendfun y 0 0 comm-world)))))
128;;      )
129;;     (test-send-recv MPI:send-int MPI:receive-int (lambda (x) (+ 1 x))
130;;                  (list 10 20 30 40 50 60 70 80 90))
131;;     (test-send-recv MPI:send-flonum MPI:receive-flonum (lambda (x) (* 2 x))
132;;                  (list 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9))
133;;     (let ((len 3)
134;;        (intdata (list (list 10 11 12) (list 20 21 22) (list 30 31 34) (list 40 41 42)))
135;;        (flodata (list (list 1.1 1.2)  (list 2.1 2.2) (list 3.1 3.2) (list 4.1 4.2)))
136;;        (srfi4-test-send-recv
137;;         (lambda (len vsend vreceive vmap list->vector)
138;;           (lambda (data)
139;;             (test_send_recv vsend (lambda (src tag comm) (vreceive len src tag comm))
140;;                             (lambda (v) (vmap (lambda (x) (+ 1 x)) v))
141;;                             (map list->vector data))))))
142;;       ((srfi4-test-send-recv len MPI:send-u8vector MPI:receive-u8vector u8vector-map list->u8vector)
143;;        intdata)
144;;       ((srfi4-test-send-recv len MPI:send-s8vector MPI:receive-s8vector s8vector-map list->s8vector)
145;;        intdata)
146;;       ((srfi4-test-send-recv len MPI:send-u16vector MPI:receive-u16vector u16vector-map list->u16vector)
147;;        intdata)
148;;       ((srfi4-test-send-recv len MPI:send-s16vector MPI:receive-s16vector s16vector-map list->s16vector)
149;;        intdata)
150;;       ((srfi4-test-send-recv len MPI:send-u32vector MPI:receive-u32vector u32vector-map list->u32vector)
151;;        intdata)
152;;       ((srfi4-test-send-recv len MPI:send-s32vector MPI:receive-s32vector s32vector-map list->s32vector)
153;;        intdata)
154;;       ((srfi4-test-send-recv len MPI:send-f32vector MPI:receive-f32vector f32vector-map list->f32vector)
155;;        flodata)
156;;       ((srfi4-test-send-recv len MPI:send-f64vector MPI:receive-f64vector f64vector-map list->f64vector)
157;;        flodata)))
158
159;;   ;; Barrier
160;;   (MPI:barrier comm-world)
161
162;;   (if (positive? myrank)
163;;       (sleep myrank))
164;;   (print myrank ": hitting barrier")
165;;   (MPI:barrier comm-world)
166;;   (if (zero? myrank)
167;;       (print "jumped barrier"))
168
169;;   ;;  Broadcast
170;;   (let* ((test-broadcast
171;;       (lambda (bcast data)
172;;         (if (zero? myrank)
173;;             (print myrank ": broadcasting " data))
174;;         (let ((res (bcast data 0 comm-world)))
175;;           (print myrank ": received " res)))))
176;;     (test-broadcast MPI:broadcast-bytevector (string->blob "Hello!"))
177;;     (test-broadcast MPI:broadcast-int 123456)
178;;     (test-broadcast MPI:broadcast-flonum 3.141592654)
179;;     (let ((intdata  (list 12 45 78))
180;;        (flodata  (list 3.14 2.718 0.578))
181;;        (srfi4-test-broadcast
182;;         (lambda (bcast list->vector data)
183;;           (test-broadcast bcast (list->vector data)))))
184;;       (test-broadcast MPI:broadcast-s8vector list->s8vector intdata)
185;;       (test-broadcast MPI:broadcast-u8vector list->u8vector intdata)
186;;       (test-broadcast MPI:broadcast-s16vector list->s16vector intdata)
187;;       (test-broadcast MPI:broadcast-u16vector list->u16vector intdata)
188;;       (test-broadcast MPI:broadcast-s32vector list->s32vector intdata)
189;;       (test-broadcast MPI:broadcast-u32vector list->u32vector intdata)
190;;       (test-broadcast MPI:broadcast-f32vector list->f32vector flodata)
191;;       (test-broadcast MPI:broadcast-f64vector list->f64vector flodata)))
192
193;;   ;; Barrier
194;;   (MPI:barrier comm-world)
195
196;;   ;; Scatter
197;;   (let* ((test-scatter
198;;       (lambda (scatter data)
199;;         (if (zero? myrank)
200;;             (print myrank ": scattering " data))
201;;         (let ((res (scatter data 3 0 comm-world)))
202;;           (print myrank ": received " res))
203;;         (MPI:barrier comm-world))))
204;;     (test-scatter MPI:scatter-bytevector (string->blob "aaabbbcccdddeee"))
205;;     (test-scatter MPI:scatter-int (s32vector 12 34 56 78 90))
206;;     (test-scatter MPI:scatter-flonum (s32vector 1.2 3.4 5.6 7.8 9.1))
207;;     (let ((intdata  (list 10 10 10 20 20 20 30 30 30 40 40 40 50 50 50))
208;;        (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))
209;;        (srfi4-test-scatter
210;;         (lambda (scatter list->vector data)
211;;           (test-scatter scatter (list->vector data)))))
212;;       (test-scatter MPI:scatter-s8vector list->s8vector intdata)
213;;       (test-scatter MPI:scatter-u8vector list->u8vector intdata)
214;;       (test-scatter MPI:scatter-s16vector list->s16vector intdata)
215;;       (test-scatter MPI:scatter-u16vector list->u16vector intdata)
216;;       (test-scatter MPI:scatter-s32vector list->s32vector intdata)
217;;       (test-scatter MPI:scatter-u32vector list->u32vector intdata)
218;;       (test-scatter MPI:scatter-f32vector list->f32vector flodata)
219;;       (test-scatter MPI:scatter-f64vector list->f64vector flodata)))
220     
221;;   ;; Gather
222;;   (let* ((test-gather
223;;       (lambda (gather data)
224;;         (print myrank ": sending " data)
225;;         (let ((res (gather data 3 0 comm-world)))
226;;           (if (zero? myrank)
227;;               (print myrank ": gathered " res))
228;;           (MPI:barrier comm-world)))))
229;;     (test-gather MPI:gather-bytevector
230;;               (list-ref (map string->blob (list "aaa" "bbb" "ccc" "ddd" "eee")) myrank))
231;;     (test-gather MPI:gather-int
232;;               (list-ref (list 12 34 56 78 90) myrank))
233;;     (test-gather MPI:gather-flonum
234;;               (list-ref (list 1.2 3.4 5.6 7.8 9.0) myrank))
235;;     (test-gather MPI:gather-s8vector
236;;               (s8vector (* 10 myrank) (+ 1 (* 10 myrank)) (+ 2 (* 10 myrank))))
237;;     (test-gather MPI:gather-u8vector
238;;               (u8vector (* 10 myrank) (+ 1 (* 10 myrank)) (+ 2 (* 10 myrank))))
239;;     (test-gather MPI:gather-s16vector
240;;               (s16vector (* 10 myrank) (+ 1 (* 10 myrank)) (+ 2 (* 10 myrank))))
241;;     (test-gather MPI:gather-u16vector
242;;               (u16vector (* 10 myrank) (+ 1 (* 10 myrank)) (+ 2 (* 10 myrank))))
243;;     (test-gather MPI:gather-s32vector
244;;               (s32vector (* 10 myrank) (+ 1 (* 10 myrank)) (+ 2 (* 10 myrank))))
245;;     (test-gather MPI:gather-u32vector
246;;               (u32vector (* 10 myrank) (+ 1 (* 10 myrank)) (+ 2 (* 10 myrank))))
247;;     (test-gather MPI:gather-f32vector
248;;               (f32vector (* 10 myrank) (+ 0.1 (* 10 myrank)) (+ 0.2 (* 10 myrank))))
249;;     (test-gather MPI:gather-f64vector
250;;               (f64vector (* 10 myrank) (+ 0.1 (* 10 myrank)) (+ 0.2 (* 10 myrank)))))
251
252
253;;   ;; Gather to all
254;;   (let* ((test-allgather
255;;       (lambda (allgather data)
256;;         (print myrank ": sending " data)
257;;         (let ((res (allgather data 0 comm-world)))
258;;           (print myrank ": gathered " res)
259;;           (MPI:barrier comm-world)))))
260;;     (test-allgather MPI:allgather-bytevector
261;;                  (list-ref (map string->blob (list "aaa" "bbb" "ccc" "ddd" "eee")) myrank))
262;;     (test-allgather MPI:allgather-int
263;;                  (list-ref (list 12 34 56 78 90) myrank))
264;;     (test-allgather MPI:allgather-flonum
265;;                  (list-ref (list 1.2 3.4 5.6 7.8 9.0) myrank))
266;;     (test-allgather MPI:allgather-s8vector
267;;                  (s8vector (* 10 myrank) (+ 1 (* 10 myrank)) (+ 2 (* 10 myrank))))
268;;     (test-allgather MPI:allgather-u8vector
269;;                  (u8vector (* 10 myrank) (+ 1 (* 10 myrank)) (+ 2 (* 10 myrank))))
270;;     (test-allgather MPI:allgather-s16vector
271;;                  (s16vector (* 10 myrank) (+ 1 (* 10 myrank)) (+ 2 (* 10 myrank))))
272;;     (test-allgather MPI:allgather-u16vector
273;;                  (u16vector (* 10 myrank) (+ 1 (* 10 myrank)) (+ 2 (* 10 myrank))))
274;;     (test-allgather MPI:allgather-s32vector
275;;                  (s32vector (* 10 myrank) (+ 1 (* 10 myrank)) (+ 2 (* 10 myrank))))
276;;     (test-allgather MPI:allgather-u32vector
277;;                  (u32vector (* 10 myrank) (+ 1 (* 10 myrank)) (+ 2 (* 10 myrank))))
278;;     (test-allgather MPI:allgather-f32vector
279;;                  (f32vector (* 10 myrank) (+ 0.1 (* 10 myrank)) (+ 0.2 (* 10 myrank))))
280;;     (test-allgather MPI:allgather-f64vector
281;;                  (f64vector (* 10 myrank) (+ 0.1 (* 10 myrank)) (+ 0.2 (* 10 myrank)))))
282
283
284;;   ;; Reduce
285
286;;   (let* ((test-reduce
287;;        (lambda (reducefun reduceops data)
288;;          (for-each (lambda (op)
289;;                      (let ((res (reducefun data op 0 comm-world)))
290;;                        (if (zero? myrank)
291;;                            (print myrank ": the result of reduction " op " is " res))))
292;;                    reduceops)
293;;          (MPI:barrier comm-world))))
294;;     (test-reduce MPI:reduce-int
295;;               (list MPI:i_max MPI:i_min MPI:i_sum MPI:i_prod
296;;                     MPI:i_land MPI:i_lor MPI:i_xor)
297;;               (+ 1 myrank))
298;;     (test-reduce MPI:reduce-flonum
299;;               (list MPI:f_max MPI:f_min MPI:f_sum MPI:f_prod )
300;;               (+ 0.1 myrank))
301;;     (test-reduce MPI:reduce-s8vector
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;;               (s8vector (* 2 myrank) (+ 1 (* 2 myrank)) (+ 2 (* 2 myrank))))
305;;     (test-reduce MPI:reduce-u8vector
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;;               (u8vector (* 2 myrank) (+ 1 (* 2 myrank)) (+ 2 (* 2 myrank))))
309;;     (test-reduce MPI:reduce-s16vector
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;;               (s16vector (* 2 myrank) (+ 1 (* 2 myrank)) (+ 2 (* 2 myrank))))
313;;     (test-reduce MPI:reduce-u16vector
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;;               (u16vector (* 2 myrank) (+ 1 (* 2 myrank)) (+ 2 (* 2 myrank))))
317;;     (test-reduce MPI:reduce-s32vector
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;;               (s32vector (* 2 myrank) (+ 1 (* 2 myrank)) (+ 2 (* 2 myrank))))
321;;     (test-reduce MPI:reduce-u32vector
322;;               (list MPI:i_max MPI:i_min MPI:i_sum MPI:i_prod
323;;                     MPI:i_land MPI:i_lor MPI:i_xor)
324;;               (u32vector (* 2 myrank) (+ 1 (* 2 myrank)) (+ 2 (* 2 myrank))))
325;;     (test-reduce MPI:reduce-f32vector
326;;               (list MPI:f_max MPI:f_min MPI:f_sum MPI:f_prod )
327;;               (f32vector (* 2 myrank) (+ 0.1 (* 2 myrank)) (+ 0.2 (* 2 myrank))))
328;;     (test-reduce MPI:reduce-f64vector
329;;               (list MPI:f_max MPI:f_min MPI:f_sum MPI:f_prod )
330;;               (f64vector (* 2 myrank) (+ 0.1 (* 2 myrank)) (+ 0.2 (* 2 myrank)))))
331
332;;   ;; Reduce all
333;;   (let* ((test-allreduce
334;;        (lambda (allreducefun reduceop data)
335;;          (print myrank ": data is " data)
336;;          (let ((res (allreducefun data reduceop comm-world)))
337;;            (MPI:barrier comm-world)
338;;            (print myrank ": the result of reduction " op " is " res)
339;;            (MPI:barrier comm-world)))))
340;;     (test-allreduce MPI:allreduce-int MPI:i_sum (+ 1 myrank))
341;;     (test-allreduce MPI:allreduce-flonum MPI:f_prod (+ 1.0 myrank))
342;;     (test-reduce MPI:allreduce-s8vector MPI:i_sum
343;;               (s8vector (* 2 myrank) (+ 1 (* 2 myrank)) (+ 2 (* 2 myrank))))
344;;     (test-allreduce MPI:allreduce-u8vector MPI:i_sum
345;;                  (u8vector (* 2 myrank) (+ 1 (* 2 myrank)) (+ 2 (* 2 myrank))))
346;;     (test-allreduce MPI:allreduce-s16vector MPI:i_sum
347;;                  (s16vector (* 2 myrank) (+ 1 (* 2 myrank)) (+ 2 (* 2 myrank))))
348;;     (test-allreduce MPI:allreduce-u16vector MPI:i_sum
349;;                  (u16vector (* 2 myrank) (+ 1 (* 2 myrank)) (+ 2 (* 2 myrank))))
350;;     (test-allreduce MPI:allreduce-s32vector MPI:i_sum
351;;                  (s32vector (* 2 myrank) (+ 1 (* 2 myrank)) (+ 2 (* 2 myrank))))
352;;     (test-allreduce MPI:allreduce-u32vector MPI:i_sum
353;;                  (u32vector (* 2 myrank) (+ 1 (* 2 myrank)) (+ 2 (* 2 myrank))))
354;;     (test-allreduce MPI:allreduce-f32vector MPI:f_sum 
355;;                  (f32vector (* 2 myrank) (+ 0.1 (* 2 myrank)) (+ 0.2 (* 2 myrank))))
356;;     (test-allreduce MPI:allreduce-f64vector MPI:f_sum 
357;;                  (f64vector (* 2 myrank) (+ 0.1 (* 2 myrank)) (+ 0.2 (* 2 myrank)))))
358   
359;;   ;; Scan
360;;   (let* ((test-scan
361;;        (lambda (scanfun reduceop data)
362;;          (print myrank ": data is " data)
363;;          (let ((res (scanfun data reduceop comm-world)))
364;;            (MPI:barrier comm-world)
365;;            (print myrank ": the result of scan " op " is " res)
366;;            (MPI:barrier comm-world)))))
367;;     (test-scan MPI:scan-int MPI:i_sum (+ 1 myrank))
368;;     (test-scan MPI:scan-flonum MPI:f_prod (+ 1.0 myrank))
369;;     (test-reduce MPI:scan-s8vector MPI:i_sum
370;;               (s8vector (* 2 myrank) (+ 1 (* 2 myrank)) (+ 2 (* 2 myrank))))
371;;     (test-scan MPI:scan-u8vector MPI:i_sum
372;;             (u8vector (* 2 myrank) (+ 1 (* 2 myrank)) (+ 2 (* 2 myrank))))
373;;     (test-scan MPI:scan-s16vector MPI:i_sum
374;;             (s16vector (* 2 myrank) (+ 1 (* 2 myrank)) (+ 2 (* 2 myrank))))
375;;     (test-scan MPI:scan-u16vector MPI:i_sum
376;;             (u16vector (* 2 myrank) (+ 1 (* 2 myrank)) (+ 2 (* 2 myrank))))
377;;     (test-scan MPI:scan-s32vector MPI:i_sum
378;;             (s32vector (* 2 myrank) (+ 1 (* 2 myrank)) (+ 2 (* 2 myrank))))
379;;     (test-scan MPI:scan-u32vector MPI:i_sum
380;;             (u32vector (* 2 myrank) (+ 1 (* 2 myrank)) (+ 2 (* 2 myrank))))
381;;     (test-scan MPI:scan-f32vector MPI:f_sum 
382;;             (f32vector (* 2 myrank) (+ 0.1 (* 2 myrank)) (+ 0.2 (* 2 myrank))))
383;;     (test-scan MPI:scan-f64vector MPI:f_sum 
384;;             (f64vector (* 2 myrank) (+ 0.1 (* 2 myrank)) (+ 0.2 (* 2 myrank)))))
385
386;;   ;; Comm split
387;;   (let ((send-in-comm
388;;       (lambda (c init incr)
389;;         (let ((rank-in-c (MPI:comm-rank c))
390;;               (size-of-c (MPI:comm-size c)))
391;;           (if (zero? rank-in-c)
392;;               (begin
393;;                 (print rank-in-c "[" myrank "]: sending " init)
394;;                 (MPI:send init 1 0 c)
395;;                 (let ((n (MPI:receive-bytevector MPI:any-source MPI:any-tag c)))
396;;                   (print rank-in-c "[" myrank "]: received " n)))
397;;               (let ((n (MPI:receive-bytevector MPI:any-source MPI:any-tag c)))
398;;                 (let ((n1 (string->blob (string-append (blob->string n) incr))))
399;;                   (print rank-in-c "[" myrank "]: received " n ", resending " n1)
400;;                   (MPI:send n1 (modulo (+ 1 rank-in-c) size-of-c) 0 c))))))))
401;;     (let ((c (MPI:comm-split comm-world (modulo myrank 2) 0)))
402;;       (if (zero? (modulo myrank 2))
403;;        (send-in-comm c (string->blob "aa") "a")
404;;        (send-in-comm c (string->blob "bb") "b"))
405;;       (MPI:barrier comm-world)))
406
407;;   ;; Cartesian topology
408;;   (let ((cart (MPI:make-cart comm-world (u32vector 2 2) (u32vector 0 0) #t))
409;;      (test-dims-create
410;;       (lambda (n hints)
411;;         (print "make-dims " n " " hints " = " (MPI:make-dims n hints)))))
412;;     (if (zero? myrank)
413;;      (begin
414;;        (print "ranks = " (map (lambda (x) (cons x (MPI:cart-rank cart x)))
415;;                               (u32vector 0 0) (u32vector 1 0)
416;;                               (u32vector 1 0) (u32vector 1 1)))
417;;        (print "coords = " (list-tabulate (MPI:comm-size cart)
418;;                               (lambda (n) (cons n (MPI:cart-coords cart n)))))
419;;        (test-dims-create 60 (u32vector 0 0 0))
420;;        (test-dims-create 60 (u32vector 3 0 0))
421;;        (test-dims-create 60 (u32vector 0 4 0))
422;;        (test-dims-create 60 (u32vector 3 0 5))
423;;        (MPI:barrier comm-world))))
424
425;;   ;; Wtime
426;;   (print myrank ": wtime is "  (MPI:wtime))
427;;   )
428         
429                                 
430                                 
Note: See TracBrowser for help on using the repository browser.