;;
;; Chicken MPI interface.
;;
;; Copyright 2007-2018 Ivan Raikov.
;;
;; This program is free software: you can redistribute it and/or
;; modify it under the terms of the GNU General Public License as
;; published by the Free Software Foundation, either version 3 of the
;; License, or (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; General Public License for more details.
;;
;; A full copy of the GPL license can be found at
;; .
;;
;; Derived datatypes
;; Handling of datatypes
; Include into generated code, but don't parse:
#>
static C_word MPI_datatype_p(C_word obj)
{
if (C_immediatep(obj)) {
return C_SCHEME_FALSE;
} else if (C_block_header(obj) == MPI_DATATYPE_TAG)
{
return C_SCHEME_TRUE;
} else {
return C_SCHEME_FALSE;
}
}
static C_word MPI_check_datatype (C_word obj)
{
if (C_immediatep(obj))
{
chicken_MPI_exception (MPI_ERR_COMM, "MPI_check_datatype",
32, "invalid MPI datatype object");
} else if (C_block_header(obj) == MPI_DATATYPE_TAG)
{
return C_SCHEME_UNDEFINED;
} else {
chicken_MPI_exception (MPI_ERR_COMM, "MPI_check_datatype",
32, "invalid MPI datatype object");
}
}
<#
(define MPI_type_null
(foreign-primitive nonnull-c-pointer ()
#< 0))
{
chicken_MPI_exception (MPI_ERR_TYPE, "MPI:make-type-struct",
32, "invalid MPI struct datatype size");
}
array_of_blocklens = malloc(fieldcount*sizeof(int));
array_of_displs = malloc(fieldcount*sizeof(MPI_Aint));
array_of_types = malloc(fieldcount*sizeof(MPI_Datatype));
tail = blocklens;
for (i=0; ilist result)
))
(define MPI:type-size
(foreign-safe-lambda* int ((scheme-object ty))
#<