Changeset 14411 in project for release/4/mpi/trunk/collcomm.scm


Ignore:
Timestamp:
04/24/09 07:35:08 (11 years ago)
Author:
Ivan Raikov
Message:

mpi ported to Chicken 4

Location:
release/4/mpi
Files:
1 edited
1 copied

Legend:

Unmodified
Added
Removed
  • release/4/mpi/trunk/collcomm.scm

    r10913 r14411  
    44;; Leroy.
    55;;
    6 ;; Copyright 2007 Ivan Raikov and the Okinawa Institute of Science and Technology
     6;; Copyright 2007-2009 Ivan Raikov and the Okinawa Institute of Science and Technology
    77;;
    88;; This program is free software: you can redistribute it and/or
     
    289289(define MPI:broadcast-bytevector
    290290  (make-bcast blob-size make-blob MPI_broadcast_bytevector))
    291          
    292 (define-macro (define-srfi4-broadcast type)
    293   (let ((vlen    (string->symbol (string-append (symbol->string type) "vector-length")))
    294         (makev   (string->symbol (string-append "make-" (symbol->string type) "vector")))
    295         (bcastv  (string->symbol (string-append "MPI_broadcast_" (symbol->string type) "vector")))
    296         (name    (string->symbol (string-append "MPI:broadcast-" (symbol->string type) "vector"))))
    297   `(define ,name (make-bcast ,vlen ,makev ,bcastv))))
     291
     292(define-syntax define-srfi4-broadcast
     293  (lambda (x r c)
     294    (let* ((type (cadr x))
     295           (%define (r 'define))
     296           (vlen    (string->symbol (string-append (symbol->string type) "vector-length")))
     297           (makev   (string->symbol (string-append "make-" (symbol->string type) "vector")))
     298           (bcastv  (string->symbol (string-append "MPI_broadcast_" (symbol->string type) "vector")))
     299           (name    (string->symbol (string-append "MPI:broadcast-" (symbol->string type) "vector"))))
     300      `(,%define ,name (make-bcast ,vlen ,makev ,bcastv)))))
     301
    298302
    299303(define-srfi4-broadcast s8)
     
    10711075(define MPI:scatter-bytevector (make-scatter make-blob blob-size MPI_scatter_bytevector))
    10721076         
    1073 (define-macro (define-srfi4-scatter type)
    1074   (let ((name      (string->symbol (string-append "MPI:scatter-" (symbol->string type) "vector")))
    1075         (makev     (string->symbol (string-append "make-" (symbol->string type) "vector")))
    1076         (vlen      (string->symbol (string-append (symbol->string type) "vector-length")))
    1077         (scatter  (string->symbol (string-append "MPI_scatter_" (symbol->string type) "vector"))))
    1078   `(define ,name (make-scatter ,makev ,vlen ,scatter))))
     1077(define-syntax define-srfi4-scatter
     1078  (lambda (x r c)
     1079    (let* ((type     (cadr x))
     1080           (%define  (r 'define))
     1081           (name     (string->symbol (string-append "MPI:scatter-" (symbol->string type) "vector")))
     1082           (makev    (string->symbol (string-append "make-" (symbol->string type) "vector")))
     1083           (vlen     (string->symbol (string-append (symbol->string type) "vector-length")))
     1084           (scatter  (string->symbol (string-append "MPI_scatter_" (symbol->string type) "vector"))))
     1085       `(,%define ,name (make-scatter ,makev ,vlen ,scatter)))))
    10791086
    10801087(define-srfi4-scatter s8)
     
    11711178(define MPI:scatterv-bytevector (make-scatterv blob-size make-blob bytevector_dimemcpy MPI_scatterv_bytevector))
    11721179         
    1173 (define-macro (define-srfi4-scatterv type)
    1174   (let ((vlen      (string->symbol (string-append (symbol->string type) "vector-length")))
    1175         (makev     (string->symbol (string-append "make-" (symbol->string type) "vector")))
    1176         (dimemcpy  (string->symbol (string-append (symbol->string type) "vector_dimemcpy")))
    1177         (scatterv  (string->symbol (string-append "MPI_scatterv_" (symbol->string type) "vector")))
    1178         (name      (string->symbol (string-append "MPI:scatterv-" (symbol->string type) "vector"))))
    1179   `(define ,name (make-scatterv ,vlen ,makev ,dimemcpy ,scatterv))))
     1180(define-syntax define-srfi4-scatterv
     1181  (lambda (x r c)
     1182    (let* ((type (cadr x))
     1183           (%define (r 'define))
     1184           (vlen      (string->symbol (string-append (symbol->string type) "vector-length")))
     1185           (makev     (string->symbol (string-append "make-" (symbol->string type) "vector")))
     1186           (dimemcpy  (string->symbol (string-append (symbol->string type) "vector_dimemcpy")))
     1187           (scatterv  (string->symbol (string-append "MPI_scatterv_" (symbol->string type) "vector")))
     1188           (name      (string->symbol (string-append "MPI:scatterv-" (symbol->string type) "vector"))))
     1189      `(,%define ,name (make-scatterv ,vlen ,makev ,dimemcpy ,scatterv)))))
    11801190
    11811191(define-srfi4-scatterv s8)
     
    18831893(define MPI:gather-bytevector (make-gather make-blob blob-size MPI_gather_bytevector))
    18841894         
    1885 (define-macro (define-srfi4-gather type)
    1886   (let ((name      (string->symbol (string-append "MPI:gather-" (symbol->string type) "vector")))
    1887         (makev     (string->symbol (string-append "make-" (symbol->string type) "vector")))
    1888         (vlen      (string->symbol (string-append (symbol->string type) "vector-length")))
    1889         (gather    (string->symbol (string-append "MPI_gather_" (symbol->string type) "vector"))))
    1890   `(define ,name (make-gather ,makev ,vlen ,gather))))
     1895(define-syntax define-srfi4-gather
     1896  (lambda (x r c)
     1897    (let* ((type      (cadr x))
     1898           (%define   (r 'define))
     1899           (name      (string->symbol (string-append "MPI:gather-" (symbol->string type) "vector")))
     1900           (makev     (string->symbol (string-append "make-" (symbol->string type) "vector")))
     1901           (vlen      (string->symbol (string-append (symbol->string type) "vector-length")))
     1902           (gather    (string->symbol (string-append "MPI_gather_" (symbol->string type) "vector"))))
     1903       `(,%define ,name (make-gather ,makev ,vlen ,gather)))))
    18911904
    18921905(define-srfi4-gather s8)
     
    19791992(define MPI:gatherv-bytevector (make-gatherv blob-size make-blob bytevector_simemcpy MPI_gatherv_bytevector))
    19801993         
    1981 (define-macro (define-srfi4-gatherv type)
    1982   (let ((vlen      (string->symbol (string-append (symbol->string type) "vector-length")))
    1983         (makev     (string->symbol (string-append "make-" (symbol->string type) "vector")))
    1984         (simemcpy  (string->symbol (string-append (symbol->string type) "vector_simemcpy")))
    1985         (gatherv   (string->symbol (string-append "MPI_gatherv_" (symbol->string type) "vector")))
    1986         (name      (string->symbol (string-append "MPI:gatherv-" (symbol->string type) "vector"))))
    1987   `(define ,name (make-gatherv ,vlen ,makev ,simemcpy ,gatherv))))
     1994(define-syntax define-srfi4-gatherv
     1995  (lambda (x r c)
     1996    (let* ((type      (cadr x))
     1997           (%define   (r 'define))
     1998           (vlen      (string->symbol (string-append (symbol->string type) "vector-length")))
     1999           (makev     (string->symbol (string-append "make-" (symbol->string type) "vector")))
     2000           (simemcpy  (string->symbol (string-append (symbol->string type) "vector_simemcpy")))
     2001           (gatherv   (string->symbol (string-append "MPI_gatherv_" (symbol->string type) "vector")))
     2002           (name      (string->symbol (string-append "MPI:gatherv-" (symbol->string type) "vector"))))
     2003       `(,%define ,name (make-gatherv ,vlen ,makev ,simemcpy ,gatherv)))))
    19882004
    19892005(define-srfi4-gatherv s8)
     
    23362352(define MPI:allgather-bytevector (make-allgather blob-size make-blob bytevector_simemcpy MPI_allgather_bytevector))
    23372353         
    2338 (define-macro (define-srfi4-allgather type)
    2339   (let ((vlen      (string->symbol (string-append (symbol->string type) "vector-length")))
    2340         (makev     (string->symbol (string-append "make-" (symbol->string type) "vector")))
    2341         (simemcpy  (string->symbol (string-append (symbol->string type) "vector_simemcpy")))
    2342         (allgather (string->symbol (string-append "MPI_allgather_" (symbol->string type) "vector")))
    2343         (name      (string->symbol (string-append "MPI:allgather-" (symbol->string type) "vector"))))
    2344   `(define ,name (make-allgather ,vlen ,makev ,simemcpy ,allgather))))
     2354(define-syntax define-srfi4-allgather
     2355  (lambda (x r c)
     2356    (let* ((type      (cadr x))
     2357           (%define   (r 'define))
     2358           (vlen      (string->symbol (string-append (symbol->string type) "vector-length")))
     2359           (makev     (string->symbol (string-append "make-" (symbol->string type) "vector")))
     2360           (simemcpy  (string->symbol (string-append (symbol->string type) "vector_simemcpy")))
     2361           (allgather (string->symbol (string-append "MPI_allgather_" (symbol->string type) "vector")))
     2362           (name      (string->symbol (string-append "MPI:allgather-" (symbol->string type) "vector"))))
     2363       `(,%define ,name (make-allgather ,vlen ,makev ,simemcpy ,allgather)))))
    23452364
    23462365(define-srfi4-allgather s8)
     
    27322751
    27332752         
    2734 (define-macro (define-srfi4-reduce type)
    2735   (let ((vlen      (string->symbol (string-append (symbol->string type) "vector-length")))
    2736         (makev     (string->symbol (string-append "make-" (symbol->string type) "vector")))
    2737         (reduce    (string->symbol (string-append "MPI_reduce_" (symbol->string type) "vector")))
    2738         (name      (string->symbol (string-append "MPI:reduce-" (symbol->string type) "vector"))))
    2739   `(define ,name (make-reduce ,vlen ,makev ,reduce))))
     2753(define-syntax define-srfi4-reduce
     2754  (lambda (x r c)
     2755    (let* ((type      (cadr x))
     2756           (%define   (r 'define))
     2757           (vlen      (string->symbol (string-append (symbol->string type) "vector-length")))
     2758           (makev     (string->symbol (string-append "make-" (symbol->string type) "vector")))
     2759           (reduce    (string->symbol (string-append "MPI_reduce_" (symbol->string type) "vector")))
     2760           (name      (string->symbol (string-append "MPI:reduce-" (symbol->string type) "vector"))))
     2761       `(,%define ,name (make-reduce ,vlen ,makev ,reduce)))))
    27402762
    27412763(define-srfi4-reduce s8)
     
    29943016(define (MPI:allreduce-flonum send op comm)
    29953017  (MPI_allreduce_flonum send op comm))
    2996 
    2997 
    29983018         
    2999 (define-macro (define-srfi4-allreduce type)
    3000   (let ((vlen       (string->symbol (string-append (symbol->string type) "vector-length")))
    3001         (makev      (string->symbol (string-append "make-" (symbol->string type) "vector")))
    3002         (allreduce  (string->symbol (string-append "MPI_allreduce_" (symbol->string type) "vector")))
    3003         (name       (string->symbol (string-append "MPI:allreduce-" (symbol->string type) "vector"))))
    3004   `(define ,name (make-allreduce ,vlen ,makev ,allreduce))))
     3019(define-syntax define-srfi4-allreduce
     3020  (lambda (x r c)
     3021    (let* ((type       (cadr x))
     3022           (%define    (r 'define))
     3023           (vlen       (string->symbol (string-append (symbol->string type) "vector-length")))
     3024           (makev      (string->symbol (string-append "make-" (symbol->string type) "vector")))
     3025           (allreduce  (string->symbol (string-append "MPI_allreduce_" (symbol->string type) "vector")))
     3026           (name       (string->symbol (string-append "MPI:allreduce-" (symbol->string type) "vector"))))
     3027       `(,%define ,name (make-allreduce ,vlen ,makev ,allreduce)))))
    30053028
    30063029(define-srfi4-allreduce s8)
     
    32613284
    32623285         
    3263 (define-macro (define-srfi4-scan type)
    3264   (let ((vlen       (string->symbol (string-append (symbol->string type) "vector-length")))
    3265         (makev      (string->symbol (string-append "make-" (symbol->string type) "vector")))
    3266         (scan       (string->symbol (string-append "MPI_scan_" (symbol->string type) "vector")))
    3267         (name       (string->symbol (string-append "MPI:scan-" (symbol->string type) "vector"))))
    3268   `(define ,name (make-scan ,vlen ,makev ,scan))))
     3286(define-syntax define-srfi4-scan
     3287  (lambda (x r c)
     3288    (let* ((type       (cadr x))
     3289           (%define    (r 'define))
     3290           (vlen       (string->symbol (string-append (symbol->string type) "vector-length")))
     3291           (makev      (string->symbol (string-append "make-" (symbol->string type) "vector")))
     3292           (scan       (string->symbol (string-append "MPI_scan_" (symbol->string type) "vector")))
     3293           (name       (string->symbol (string-append "MPI:scan-" (symbol->string type) "vector"))))
     3294       `(,%define ,name (make-scan ,vlen ,makev ,scan)))))
    32693295
    32703296(define-srfi4-scan s8)
Note: See TracChangeset for help on using the changeset viewer.