Created
June 11, 2015 20:52
-
-
Save TooTallNate/75bd3b71927c76bb581b to your computer and use it in GitHub Desktop.
MPI and node-ffi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var ref = require('ref'); | |
var Struct = require('ref-struct'); | |
var ffi = require('ffi'); | |
// typedefs | |
var MPI_Datatype = 'int'; | |
var MPI_Comm = 'int'; | |
var MPI_Status = Struct({ | |
count: 'int', | |
MPI_SOURCE: 'int', | |
MPI_TAG: 'int', | |
MPI_ERROR: 'int' | |
}); | |
var MPI_StatusPtr = ref.refType(MPI_Status); | |
var mpi = ffi.Library({ | |
// int MPI_Send(void*, int, MPI_Datatype, int, int, MPI_Comm); | |
MPI_Send: [ 'int', [ 'void*', 'int', MPI_Datatype, 'int', 'int', MPI_Comm ] ], | |
// int MPI_Recv(void*, int, MPI_Datatype, int, int, MPI_Comm, MPI_Status *); | |
MPI_Recv: [ 'int', [ 'void*', 'int', MPI_Datatype, 'int', 'int', MPI_Comm, MPI_StatusPtr ] ] | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment