Changeset 7318 in project


Ignore:
Timestamp:
01/09/08 01:02:00 (12 years ago)
Author:
iraikov
Message:

Some attempts to use MPI_Comm_free.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • mpi/trunk/comm.scm

    r7296 r7318  
    5858(define MPI:comm? (foreign-lambda scheme-object "MPI_comm_p" scheme-object))
    5959
     60(define MPI_comm_finalizer
     61    (foreign-safe-lambda* void ((scheme-object comm))
     62#<<END
     63   MPI_Comm *x;
     64   MPI_check_comm (comm);
     65
     66   x = Comm_val (comm);
     67
     68//     MPI_Comm_free (&x);
     69END
     70))
     71
    6072(define MPI_alloc_comm
    61     (foreign-primitive scheme-object ((nonnull-c-pointer comm))
     73    (foreign-primitive scheme-object ((nonnull-c-pointer comm)
     74                                      (scheme-object finalizer))
    6275#<<END
    6376
     
    6982   result = (C_word)&newcomm;
    7083
    71 // TODO: invoke set-finalizer!
     84//   C_do_register_finalizer(result, finalizer);
    7285   
    7386   C_return (result);
     
    7588))
    7689
    77 
    7890(define MPI_comm_world
    7991    (foreign-primitive nonnull-c-pointer ()
     
    88100
    89101(define (MPI:get-comm-world)
    90   (let ((w     (MPI_comm_world)))
    91     (MPI_alloc_comm w)))
     102  (let ((w (MPI_comm_world)))
     103    (MPI_alloc_comm w MPI_comm_finalizer)))
    92104
    93105
     
    182194
    183195(define (MPI:comm-split comm color split)
    184   (MPI_alloc_comm (MPI_comm_split comm color split)))
     196  (MPI_alloc_comm (MPI_comm_split comm color split) MPI_comm_finalizer))
    185197
    186198#>
     
    214226
    215227(define (MPI:comm-create comm group)
    216   (MPI_alloc_comm (MPI_comm_create comm group)))
     228  (MPI_alloc_comm (MPI_comm_create comm group) MPI_comm_finalizer))
    217229
    218230(define MPI:undefined (foreign-lambda scheme-object "MPI_get_undefined"))
     
    249261   (MPI_cart_create
    250262    comm (u32vector-length dims) (u32vector-length periods)
    251     dims periods reorder)))
     263    dims periods reorder)
     264   MPI_comm_finalizer))
    252265
    253266(define MPI_dims_create
Note: See TracChangeset for help on using the changeset viewer.