1
1

added another romio wrapper function

started to populate action table

This commit was SVN r451.
Этот коммит содержится в:
Mark Taylor 2004-01-16 22:08:54 +00:00
родитель e20c037b56
Коммит 19a29f959e
6 изменённых файлов: 118 добавлений и 11 удалений

Просмотреть файл

@ -8,12 +8,17 @@
#include "mca/mca.h"
/*
* Macro for use in modules that are of type pml v1.0.0
* Macro for use in modules that are of type io v1.0.0
* 1-1 mapping of all MPI-IO functions
*/
#define MCA_IO_BASE_VERSION_1_0_0 \
MCA_BASE_VERSION_1_0_0, \
"io", 1, 0, 0
/*
* Macro for use in modules that are of type io v2.0.0
* as of yet undefined, but not 1-1 mapping of all MPI-IO functions
*/
#define MCA_IO_BASE_VERSION_2_0_0 \
MCA_BASE_VERSION_1_0_0, \
"io", 2, 0, 0
@ -34,8 +39,42 @@ struct mca_io_base_module_1_0_0_t {
typedef struct mca_io_base_module_1_0_0_t mca_io_base_module_1_0_0_t;
//TODO:
//remove when added to LAM:
typedef long long MPI_Offset;
//
// add typedefs for all MPI-IO functions to io.h
// add prototypes for all MPI-IO functions to io_romio.h
// add all functions to struct mca_io_1_0_0_t
// set all functions in struct in io_romio_module.c
//
typedef int (*mca_io_base_File_open_t)(MPI_Comm comm, char *filename, int amode,
MPI_Info info, MPI_File *fh);
typedef int (*mca_io_base_File_close_t)(MPI_File *fh);
typedef int (*mca_io_base_File_delete_t)(char *filename, MPI_Info info);
typedef int (*mca_io_base_File_set_size_t)(MPI_File fh, MPI_Offset size);
typedef int (*mca_io_base_File_preallocate_t)(MPI_File fh, MPI_Offset size);
typedef int (*mca_io_base_File_get_size_t)(MPI_File fh, MPI_Offset *size);
typedef int (*mca_io_base_File_get_group_t)(MPI_File fh, MPI_Group *group);
typedef int (*mca_io_base_File_get_amode_t)(MPI_File fh, int *amode);
typedef int (*mca_io_base_File_set_info_t)(MPI_File fh, MPI_Info info);
typedef int (*mca_io_base_File_get_info_t)(MPI_File fh, MPI_Info *info_used);
struct mca_io_1_0_0_t {
mca_io_base_File_open_t io_File_open;
mca_io_base_File_close_t io_File_close;
mca_io_base_File_delete_t io_File_delete;
mca_io_base_File_set_size_t io_File_set_size;
mca_io_base_File_preallocate_t io_File_preallocate;
mca_io_base_File_get_size_t io_File_get_size;
mca_io_base_File_get_group_t io_File_get_group;
mca_io_base_File_get_amode_t io_File_get_amode;
mca_io_base_File_set_info_t io_File_set_info;
mca_io_base_File_get_info_t io_File_get_info;
};
typedef struct mca_io_1_0_0_t mca_io_1_0_0_t;

Просмотреть файл

@ -1,3 +1,35 @@
/*
* $HEADER$
*/
#include "mpi.h"
#include "mpi/file/file.h"
#include "io_romio.h"
#include "mpi/request/request.h"
#include "lam/mem/malloc.h"
#include <string.h>
int mca_io_romio_File_open(MPI_Comm comm, char *filename, int amode,
MPI_Info info, MPI_File *fh){
int ret;
mca_io_romio_MPI_File romio_fh;
mca_io_romio_file_t *mca_romio_fh;
mca_romio_fh = LAM_MALLOC(sizeof(mca_io_romio_file_t));
(*fh) = (lam_file_t *) mca_romio_fh;
strncpy((*fh)->f_name,filename,MPI_MAX_OBJECT_NAME);
romio_fh = mca_romio_fh->romio_fh;
THREAD_LOCK(&mca_io_romio_mutex);
ret=mca_io_romio_MPI_File_open(comm,filename,amode,info,&romio_fh);
THREAD_UNLOCK(&mca_io_romio_mutex);
return ret;
}

Просмотреть файл

@ -8,8 +8,6 @@
#include "mpi/request/request.h"
#include "lam/mem/malloc.h"
int mca_io_romio_File_iwrite(MPI_File fh, void *buf, int count,
MPI_Datatype datatype, lam_request_t **request);
int mca_io_romio_File_iwrite(MPI_File fh, void *buf, int count,
MPI_Datatype datatype, lam_request_t **request)
{
@ -21,7 +19,7 @@ int mca_io_romio_File_iwrite(MPI_File fh, void *buf, int count,
*request = (lam_request_t*) rq;
(*request)->req_type = LAM_REQUEST_IO;
romio_fh = fh->f_io_file->romio_fh;
romio_fh = ((mca_io_romio_file_t *) fh)->romio_fh;
THREAD_LOCK(&mca_io_romio_mutex);
ret=mca_io_romio_MPI_File_iwrite(romio_fh, buf, count, datatype,

Просмотреть файл

@ -6,6 +6,7 @@
#define MCA_IO_ROMIO_H
#include "mpi/request/request.h"
#include "mpi/file/file.h"
#include "lam/threads/mutex.h"
@ -19,20 +20,37 @@ struct mca_io_romio_request_t {
typedef struct mca_io_romio_request_t mca_io_romio_request_t;
//version numbers
//actions struct
struct mca_io_file_t {
char * romio_fh;
struct mca_io_romio_file_t {
lam_file_t super;
mca_io_romio_MPI_File romio_fh;
};
typedef struct mca_io_file_t mca_io_file_t;
typedef struct mca_io_romio_file_t mca_io_romio_file_t;
// global variables, instantiated in global.c
/* global variables, instantiated in global.c */
extern lam_mutex_t mca_io_romio_mutex;
/* function prototypes */
int mca_io_romio_File_open(MPI_Comm comm, char *filename, int amode,
MPI_Info info, MPI_File *fh);
int mca_io_romio_File_close(MPI_File *fh);
int mca_io_romio_File_delete(char *filename, MPI_Info info);
int mca_io_romio_File_set_size(MPI_File fh, MPI_Offset size);
int mca_io_romio_File_preallocate(MPI_File fh, MPI_Offset size);
int mca_io_romio_File_get_size(MPI_File fh, MPI_Offset *size);
int mca_io_romio_File_get_group(MPI_File fh, MPI_Group *group);
int mca_io_romio_File_get_amode(MPI_File fh, int *amode);
int mca_io_romio_File_set_info(MPI_File fh, MPI_Info info);
int mca_io_romio_File_get_info(MPI_File fh, MPI_Info *info_used);
int mca_io_romio_File_iwrite(MPI_File fh, void *buf, int count,
MPI_Datatype datatype, lam_request_t **request);
#endif /* MCA_IO_ROMIO_H */

Просмотреть файл

@ -57,12 +57,28 @@ int mca_io_romio_module_close(void)
mca_io_1_0_0_t fp;
mca_io_1_0_0_t* mca_io_romio_module_init(int* priority, int* min_thread, int* max_thread)
{
*priority=10;
*min_thread = MPI_THREAD_SINGLE;
*max_thread = MPI_THREAD_SERIALIZED;
return NULL; /* should return function pointer tables */
fp.io_File_open = mca_io_romio_File_open;
fp.io_File_close = mca_io_romio_File_close;
fp.io_File_delete = mca_io_romio_File_delete;
fp.io_File_set_size = mca_io_romio_File_set_size;
fp.io_File_preallocate = mca_io_romio_File_preallocate;
fp.io_File_get_size = mca_io_romio_File_get_size;
fp.io_File_get_group = mca_io_romio_File_get_group;
fp.io_File_get_amode = mca_io_romio_File_get_amode;
fp.io_File_set_info = mca_io_romio_File_set_info;
fp.io_File_get_info = mca_io_romio_File_get_info;
return &fp;
}

Просмотреть файл

@ -14,4 +14,8 @@ int mca_io_romio_MPI_File_iwrite(mca_io_romio_MPI_File, void *,
int, MPI_Datatype, mca_io_romio_MPIO_Request);
int mca_io_romio_MPI_File_open(MPI_Comm comm, char *filename, int amode,
MPI_Info info, mca_io_romio_MPI_File *fh);
#endif