Skip to content

Commit

Permalink
First!
Browse files Browse the repository at this point in the history
A first cut of Froozle MPI, a no-op MPI implementation just to
experiment with MPI Forum issue #137
(mpi-forum/mpi-issues#137).

This commit includes a first cut of C and C++ APIs; Fortran is still
to come.

Signed-off-by: Jeff Squyres <jsquyres@cisco.com>
  • Loading branch information
jsquyres committed Jun 3, 2019
0 parents commit 125b5af
Show file tree
Hide file tree
Showing 41 changed files with 1,023 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
*.in
Makefile

autom4te.cache

config.log
config.status
config.guess
config.sub

aclocal.m4
configure
libtool
stamp-h?

.libs
.deps

*.o
*.lo
*.la
34 changes: 34 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.

- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer listed
in this license in the documentation and/or other materials
provided with the distribution.

- Neither the name of the copyright holders nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

The copyright holders provide no reassurances that the source code
provided does not infringe any patent, copyright, or any other
intellectual property rights of third parties. The copyright holders
disclaim any liability to any recipient for claims brought against
recipient by any third party for infringement of that parties
intellectual property rights.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
10 changes: 10 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Copyright (c) 2019 Cisco Systems, Inc. All rights reserved.

SUBDIRS = \
config \
c \
cxx \
fortran-mpifh \
fortran-usempi \
fortran-usempif08 \
examples
62 changes: 62 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
This is a dummy, no-op MPI implementation that is an example of
[MPI Forum issue
#137](https://github.com/mpi-forum/mpi-issues/issues/137).

Specifically: the API calls in these libraries do nothing other than
print out that they were called. The intent is to show how ticket
#137 could be implemented, and what the resulting symbols will look
like. It also gives a platform for real experimentation with
different compilers, options, run-time environments, etc.

Froozle MPI provides only a few MPI API functions, just to give a
flavor of how things will look with ticket #137:

- MPI_INIT, MPI_FINALIZE, MPI_COMM_RANK, MPI_COMM_SIZE
- MPI_SEND, MPI_RECV
- MPI_ALLGATHER

5 flavors of the APIs are available:

1. C: in the c/ directory. Both "int" and "MPI_Count" versions of the
send, receive, and allgather APIs are implemented.

2. C++: in the cxx/ directory. The C symbols are used for everything
except for the send, receive, and allgather APIs.

3. Fortran mpif.h: in the fortran-mpifh/ directory. The "glue" APIs
(init, finalize, comm_rank, comm_size) are implemented in Fortran.
The others are implemented in C, but per ticket #137, only "integer"
versions are available.

4. Fortran mpi module: in the fortran-usempi/ directory. ...more to
write here.

5. Fortran mpi_f08 module: in the fortran-usempif08/ directory.
...more to write here.

You must have a C, C++, and Fortran compiler available to compile
Froozle.

Build Froozle with the following:

----
# If running from a git clone, you must have the GNU Autotools
# installed, and then run:
$ ./autogen.sh

# If you are building from a bootstrapped tarball, you can skip the
# above autogen.sh step proceed directly to the next steps.

# Run the configure script:
$ ./configure |& tee config.out

# Build Froozle
$ make -j 8 |& tee make.out

# Optionally install Froozle
$ make install
-----

A few example applications are in the examples/ directory.

Comments are welcome.
5 changes: 5 additions & 0 deletions autogen.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh

set +x

autoreconf -ivf
1 change: 1 addition & 0 deletions c/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
mpi-config.h
19 changes: 19 additions & 0 deletions c/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright (c) 2019 Cisco Systems, Inc. All rights reserved.

lib_LTLIBRARIES = libmpi.la

libmpi_la_SOURCES = \
mpi.h \
mpi-config.h \
mpi-common.h \
globals.c \
allgather_int.c \
allgather_count.c \
comm_rank.c \
comm_size.c \
finalize.c \
init.c \
recv_int.c \
recv_count.c \
send_int.c \
send_count.c
22 changes: 22 additions & 0 deletions c/allgather_count.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Copyright (c) 2019 Cisco Systems, Inc. All rights reserved.
*/

#include "froozle_config.h"

#include <stdio.h>

#define FROOZLE_BUILDING 1

#include "mpi.h"


int MPI_Allgather_count(const void *sendbuf, MPI_Count sendcount,
MPI_Datatype sendtype,
void *recvbuf, MPI_Count recvcount,
MPI_Datatype recvtype, MPI_Comm comm)
{
printf("This is C MPI_Allgather_count\n");

return MPI_SUCCESS;
}
22 changes: 22 additions & 0 deletions c/allgather_int.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Copyright (c) 2019 Cisco Systems, Inc. All rights reserved.
*/

#include "froozle_config.h"

#include <stdio.h>

#define FROOZLE_BUILDING 1

#include "mpi.h"


int MPI_Allgather(const void *sendbuf, int sendcount,
MPI_Datatype sendtype,
void *recvbuf, int recvcount,
MPI_Datatype recvtype, MPI_Comm comm)
{
printf("This is C MPI_Allgather_count\n");

return MPI_SUCCESS;
}
19 changes: 19 additions & 0 deletions c/comm_rank.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Copyright (c) 2019 Cisco Systems, Inc. All rights reserved.
*/

#include "froozle_config.h"

#include <stdio.h>

#define FROOZLE_BUILDING 1

#include "mpi.h"


int MPI_Comm_rank(MPI_Comm comm, int *rank)
{
printf("This is C MPI_Comm_rank\n");

return MPI_SUCCESS;
}
19 changes: 19 additions & 0 deletions c/comm_size.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Copyright (c) 2019 Cisco Systems, Inc. All rights reserved.
*/

#include "froozle_config.h"

#include <stdio.h>

#define FROOZLE_BUILDING 1

#include "mpi.h"


int MPI_Comm_size(MPI_Comm comm, int *size)
{
printf("This is C MPI_Comm_size\n");

return MPI_SUCCESS;
}
19 changes: 19 additions & 0 deletions c/finalize.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Copyright (c) 2019 Cisco Systems, Inc. All rights reserved.
*/

#include "froozle_config.h"

#include <stdio.h>

#define FROOZLE_BUILDING 1

#include "mpi.h"


int MPI_Finalize(void)
{
printf("This is C MPI_Finalize\n");

return MPI_SUCCESS;
}
30 changes: 30 additions & 0 deletions c/globals.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Copyright (c) 2019 Cisco Systems, Inc. All rights reserved.
*/

#include "froozle_config.h"

#include <stdio.h>

#define FROOZLE_BUILDING 1

#include "mpi.h"

struct froozle_comm {
int bogus;
};

struct froozle_datatype {
int bogus;
};


static struct froozle_comm froozle_comm_world = {0};

static struct froozle_datatype froozle_int = {0};
static struct froozle_datatype froozle_char = {0};

MPI_Comm MPI_COMM_WORLD = &froozle_comm_world;

MPI_Datatype MPI_INT = &froozle_int;
MPI_Datatype MPI_CHAR = &froozle_char;
25 changes: 25 additions & 0 deletions c/init.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Copyright (c) 2019 Cisco Systems, Inc. All rights reserved.
*/

#include "froozle_config.h"

#include <stdio.h>

#define FROOZLE_BUILDING 1

#include "mpi.h"


int MPI_Init(int *argc, char ***argv)
{
printf("This is C MPI_Init\n");

#if FROOZLE_HAVE_C11_GENERIC
printf("NOTE: This Froozle built with C11 _Generic support. Yay!\n");
#else
printf("NOTE: This Froozle was built without C11 _Generic support. Bummer.\n");
#endif

return MPI_SUCCESS;
}
40 changes: 40 additions & 0 deletions c/mpi-common.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Copyright (c) 2019 Cisco Systems, Inc. All rights reserved.
*/

#ifndef MPI_COMMON_H
#define MPI_COMMON_H

/***************************************************************/

struct froozle_comm;
struct froozle_datatype;
struct froozle_status;

typedef struct froozle_comm *MPI_Comm;
typedef struct froozle_datatype *MPI_Datatype;

typedef struct froozle_status MPI_Status;

typedef long MPI_Count;

enum {
MPI_SUCCESS
};

extern MPI_Comm MPI_COMM_WORLD;

extern MPI_Datatype MPI_INT;
extern MPI_Datatype MPI_CHAR;

/***************************************************************/

// These functions do not have count arguments, and are therefore
// shared between both C and C++ interfaces.

int MPI_Init(int *argc, char ***argv);
int MPI_Comm_rank(MPI_Comm comm, int *rank);
int MPI_Comm_size(MPI_Comm comm, int *size);
int MPI_Finalize(void);

#endif // !MPI_COMMON_H
Loading

0 comments on commit 125b5af

Please sign in to comment.