OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
mumps_io.c File Reference
#include "mumps_io.h"
#include "mumps_io_basic.h"
#include "mumps_io_err.h"
#include "mumps_c_types.h"
#include "mumps_io_thread.h"

Go to the source code of this file.

Functions

void MUMPS_CALL MUMPS_DUMPRHSBINARY_C (MUMPS_INT *N, MUMPS_INT *NRHS, MUMPS_INT *LRHS, float *RHS, MUMPS_INT *K35, char *filename, mumps_ftnlen l1)
void MUMPS_CALL MUMPS_DUMPMATBINARY_C (MUMPS_INT *N, MUMPS_INT8 *NNZ, MUMPS_INT *K35, MUMPS_INT *irn, MUMPS_INT *jcn, void *A, MUMPS_INT *is_A_provided, char *filename, mumps_ftnlen l1)
void MUMPS_CALL MUMPS_TEST_REQUEST_C (MUMPS_INT *request_id, MUMPS_INT *flag, MUMPS_INT *ierr)
void MUMPS_CALL MUMPS_WAIT_REQUEST (MUMPS_INT *request_id, MUMPS_INT *ierr)
void MUMPS_CALL MUMPS_LOW_LEVEL_INIT_PREFIX (MUMPS_INT *dim, char *str, mumps_ftnlen l1)
void MUMPS_CALL MUMPS_LOW_LEVEL_INIT_TMPDIR (MUMPS_INT *dim, char *str, mumps_ftnlen l1)
void MUMPS_CALL MUMPS_LOW_LEVEL_INIT_OOC_C (MUMPS_INT *_myid, MUMPS_INT *total_size_io, MUMPS_INT *size_element, MUMPS_INT *async, MUMPS_INT *k211, MUMPS_INT *nb_file_type, MUMPS_INT *flag_tab, MUMPS_INT *ierr)
void MUMPS_CALL MUMPS_LOW_LEVEL_WRITE_OOC_C (const MUMPS_INT *strat_IO, void *address_block, MUMPS_INT *block_size_int1, MUMPS_INT *block_size_int2, MUMPS_INT *inode, MUMPS_INT *request_arg, MUMPS_INT *type, MUMPS_INT *vaddr_int1, MUMPS_INT *vaddr_int2, MUMPS_INT *ierr)
void MUMPS_CALL MUMPS_LOW_LEVEL_READ_OOC_C (const MUMPS_INT *strat_IO, void *address_block, MUMPS_INT *block_size_int1, MUMPS_INT *block_size_int2, MUMPS_INT *inode, MUMPS_INT *request_arg, MUMPS_INT *type, MUMPS_INT *vaddr_int1, MUMPS_INT *vaddr_int2, MUMPS_INT *ierr)
void MUMPS_CALL MUMPS_LOW_LEVEL_DIRECT_READ (void *address_block, MUMPS_INT *block_size_int1, MUMPS_INT *block_size_int2, MUMPS_INT *type, MUMPS_INT *vaddr_int1, MUMPS_INT *vaddr_int2, MUMPS_INT *ierr)
void MUMPS_CALL MUMPS_CLEAN_IO_DATA_C (MUMPS_INT *myid, MUMPS_INT *step, MUMPS_INT *ierr)
void MUMPS_CALL MUMPS_OOC_PRINT_STATS ()
void MUMPS_CALL MUMPS_GET_MAX_NB_REQ_C (MUMPS_INT *max, MUMPS_INT *ierr)
void MUMPS_CALL MUMPS_GET_MAX_FILE_SIZE_C (double *max_ooc_file_size)
void MUMPS_CALL MUMPS_OOC_GET_NB_FILES_C (const MUMPS_INT *type, MUMPS_INT *nb_files)
void MUMPS_CALL MUMPS_OOC_GET_FILE_NAME_C (MUMPS_INT *type, MUMPS_INT *indice, MUMPS_INT *length, char *name, mumps_ftnlen l1)
void MUMPS_CALL MUMPS_OOC_SET_FILE_NAME_C (MUMPS_INT *type, MUMPS_INT *indice, MUMPS_INT *length, MUMPS_INT *ierr, char *name, mumps_ftnlen l1)
void MUMPS_CALL MUMPS_OOC_ALLOC_POINTERS_C (MUMPS_INT *nb_file_type, MUMPS_INT *dim, MUMPS_INT *ierr)
void MUMPS_CALL MUMPS_OOC_INIT_VARS_C (MUMPS_INT *myid_arg, MUMPS_INT *size_element, MUMPS_INT *async, MUMPS_INT *k211, MUMPS_INT *ierr)
void MUMPS_CALL MUMPS_OOC_START_LOW_LEVEL (MUMPS_INT *ierr)
void MUMPS_CALL MUMPS_OOC_REMOVE_FILE_C (MUMPS_INT *ierr, char *name, mumps_ftnlen l1)
void MUMPS_CALL MUMPS_OOC_END_WRITE_C (MUMPS_INT *ierr)
void MUMPS_CALL MUMPS_OOC_IS_ASYNC_AVAIL (MUMPS_INT *flag)
MUMPS_INLINE MUMPS_INT mumps_convert_2fint_to_longlong (MUMPS_INT *short_int1, MUMPS_INT *short_int2, long long *long_int)

Variables

double mumps_time_spent_in_sync
double read_op_vol
double write_op_vol
double total_vol

Function Documentation

◆ MUMPS_CLEAN_IO_DATA_C()

void MUMPS_CALL MUMPS_CLEAN_IO_DATA_C ( MUMPS_INT * myid,
MUMPS_INT * step,
MUMPS_INT * ierr )

Definition at line 463 of file mumps_io.c.

464{
465 char buf[64]; /* for error message */
466 MUMPS_INT step_loc,myid_loc,ierr_loc;
467 step_loc=(MUMPS_INT)*step;
468 myid_loc=(MUMPS_INT)*myid;
470 return;
471 }
472 switch(mumps_io_flag_async){
473 case IO_SYNC:
474 break;
475#if ! defined(MUMPS_WIN32) && ! defined(WITHOUT_PTHREAD)
476 case IO_ASYNC_TH:
477 ierr_loc=mumps_clean_io_data_c_th(&myid_loc);
478 *ierr=(MUMPS_INT)ierr_loc;
479 break;
480#endif
481 default:
482 *ierr=-91;
483 sprintf(buf,"Error: unknown I/O strategy : %d\n",(int)mumps_io_flag_async);
484 mumps_io_error((MUMPS_INT)*ierr,buf);
485 return;
486 }
487 mumps_free_file_pointers(&step_loc);
489 return;
490}
#define MUMPS_INT
MUMPS_INT mumps_io_flag_async
MUMPS_INT mumps_io_is_init_called
MUMPS_INT mumps_free_file_pointers(MUMPS_INT *step)
#define IO_ASYNC_TH
#define IO_SYNC
MUMPS_INT mumps_io_error(MUMPS_INT mumps_errno, const char *desc)
MUMPS_INT mumps_clean_io_data_c_th(MUMPS_INT *myid)

◆ mumps_convert_2fint_to_longlong()

MUMPS_INLINE MUMPS_INT mumps_convert_2fint_to_longlong ( MUMPS_INT * short_int1,
MUMPS_INT * short_int2,
long long * long_int )

IMPORTANT:

After every modification of the code of convert_2fint_to_longlong update the corresponding fortran subroutines MUMPS_OOC_CONVERT_2INTTOVADDR and MUMPS_OOC_CONVERT_VADDRTO2INT

Definition at line 668 of file mumps_io.c.

670{
671 *long_int=((long long)(*short_int1)*((long long)1073741824))+(long long)(*short_int2);
672 return 0;
673}

◆ MUMPS_DUMPMATBINARY_C()

void MUMPS_CALL MUMPS_DUMPMATBINARY_C ( MUMPS_INT * N,
MUMPS_INT8 * NNZ,
MUMPS_INT * K35,
MUMPS_INT * irn,
MUMPS_INT * jcn,
void * A,
MUMPS_INT * is_A_provided,
char * filename,
mumps_ftnlen l1 )

Definition at line 43 of file mumps_io.c.

47{
48 int64_t i8;
49 int32_t myN, tmpi;
50 FILE *fd;
51 fd=fopen(filename, "w");
52 /* cast to int32_t in case MUMPS_INT is 64-bits */
53 myN=(int32_t)(*N);
54 fwrite( &myN, sizeof(int32_t), 1, fd);
55 fwrite( NNZ, sizeof(int64_t), 1, fd);
56 if (*NNZ > 0)
57 {
58 if ( sizeof(MUMPS_INT) == 4 )
59 {
60 /* write irn and jcn contents directly */
61 fwrite( irn, sizeof(int32_t), (size_t)(*NNZ), fd);
62 fwrite( jcn, sizeof(int32_t), (size_t)(*NNZ), fd);
63 }
64 else
65 {
66 for(i8=0;i8 < *NNZ;i8++)
67 {
68 tmpi=irn[i8];
69 fwrite(&tmpi, sizeof(int32_t), 1, fd);
70 }
71 for(i8=0;i8 < *NNZ;i8++)
72 {
73 tmpi=jcn[i8];
74 fwrite(&tmpi, sizeof(int32_t), 1, fd);
75 }
76 }
77 if (*is_A_provided)
78 {
79 fwrite(A, (size_t)(*K35), (size_t)(*NNZ), fd);
80 }
81 }
82 fclose(fd);
83}
#define N

◆ MUMPS_DUMPRHSBINARY_C()

void MUMPS_CALL MUMPS_DUMPRHSBINARY_C ( MUMPS_INT * N,
MUMPS_INT * NRHS,
MUMPS_INT * LRHS,
float * RHS,
MUMPS_INT * K35,
char * filename,
mumps_ftnlen l1 )

Definition at line 27 of file mumps_io.c.

30{
31 float *RHSshift; /* float: arbitrary, we use binary content */
32 FILE *fd;
33 int icol;
34 fd=fopen(filename, "w");
35 RHSshift=RHS;
36 for(icol=0;icol<*NRHS;icol++)
37 {
38 fwrite(RHSshift, (size_t)(*K35), (size_t)(*N), fd);
39 RHSshift=RHSshift+(size_t)(*LRHS)*(size_t)(*K35/sizeof(float));
40 }
41 fclose(fd);
42}
#define NRHS
we set the rigth hand side id RHS

◆ MUMPS_GET_MAX_FILE_SIZE_C()

void MUMPS_CALL MUMPS_GET_MAX_FILE_SIZE_C ( double * max_ooc_file_size)

Definition at line 526 of file mumps_io.c.

527{
529 return;
530}
#define MAX_FILE_SIZE
double precision, save max_ooc_file_size
Definition cmumps_ooc.F:47

◆ MUMPS_GET_MAX_NB_REQ_C()

void MUMPS_CALL MUMPS_GET_MAX_NB_REQ_C ( MUMPS_INT * max,
MUMPS_INT * ierr )

Definition at line 504 of file mumps_io.c.

505{
506 char buf[64]; /* for error message */
507 *ierr=0;
508 switch(mumps_io_flag_async){
509 case IO_SYNC:
510 *max=1;
511 break;
512#if ! defined(MUMPS_WIN32) && ! defined(WITHOUT_PTHREAD)
513 case IO_ASYNC_TH:
515 break;
516#endif
517 default:
518 *ierr=-91;
519 sprintf(buf,"Error: unknown I/O strategy : %d\n",(int)mumps_io_flag_async);
520 mumps_io_error((MUMPS_INT)*ierr,buf);
521 return;
522 }
523 return;
524}
#define max(a, b)
Definition macros.h:21
#define MAX_IO
#define MAX_FINISH_REQ

◆ MUMPS_LOW_LEVEL_DIRECT_READ()

void MUMPS_CALL MUMPS_LOW_LEVEL_DIRECT_READ ( void * address_block,
MUMPS_INT * block_size_int1,
MUMPS_INT * block_size_int2,
MUMPS_INT * type,
MUMPS_INT * vaddr_int1,
MUMPS_INT * vaddr_int2,
MUMPS_INT * ierr )

Definition at line 421 of file mumps_io.c.

428{
429 /* MUMPS_INT ret_code=0; */
430 long long vaddr,block_size;
431 MUMPS_INT type_loc,ierr_loc;
432#if ! defined(MUMPS_WIN32)
433 struct timeval start_time,end_time;
434 gettimeofday(&start_time,NULL);
435#endif
436 type_loc=(MUMPS_INT)*type;
437 mumps_convert_2fint_to_longlong(vaddr_int1,vaddr_int2,&vaddr);
438 mumps_convert_2fint_to_longlong(block_size_int1,block_size_int2,&block_size);
439#if ! defined(MUMPS_WIN32) && ! defined(WITHOUT_PTHREAD)
441#else
443#endif
444 {
445 ierr_loc=mumps_io_do_read_block(address_block,block_size,&type_loc,vaddr,&ierr_loc);
446 *ierr=(MUMPS_INT)ierr_loc;
447 if(*ierr<0){
448 return;
449 }
450 } else {
451 }
452#if ! defined(MUMPS_WIN32)
453# if ! defined(WITHOUT_PTHREAD)
454# endif
455 gettimeofday(&end_time,NULL);
456 mumps_time_spent_in_sync=mumps_time_spent_in_sync+((double)end_time.tv_sec+((double)end_time.tv_usec/1000000))-((double)start_time.tv_sec+((double)start_time.tv_usec/1000000));
457#endif
458 read_op_vol=read_op_vol+((double)(block_size)*(double)mumps_elementary_data_size);
459 return;
460}
MUMPS_INLINE MUMPS_INT mumps_convert_2fint_to_longlong(MUMPS_INT *short_int1, MUMPS_INT *short_int2, long long *long_int)
Definition mumps_io.c:668
double read_op_vol
Definition mumps_io.c:26
double mumps_time_spent_in_sync
Definition mumps_io.c:24
MUMPS_INT mumps_io_do_read_block(void *address_block, long long block_size, MUMPS_INT *type_arg, long long vaddr, MUMPS_INT *ierr)
MUMPS_INT mumps_elementary_data_size

◆ MUMPS_LOW_LEVEL_INIT_OOC_C()

void MUMPS_CALL MUMPS_LOW_LEVEL_INIT_OOC_C ( MUMPS_INT * _myid,
MUMPS_INT * total_size_io,
MUMPS_INT * size_element,
MUMPS_INT * async,
MUMPS_INT * k211,
MUMPS_INT * nb_file_type,
MUMPS_INT * flag_tab,
MUMPS_INT * ierr )

Definition at line 200 of file mumps_io.c.

203{
204 char buf[128]; /* for error message */
205 MUMPS_INT myid_loc,async_loc,size_element_loc,nb_file_type_loc,*flag_tab_loc;
206#if ! defined(MUMPS_WIN32) && ! defined(WITHOUT_PTHREAD)
207 MUMPS_INT ierr_loc;
208#endif
209 long long total_size_io_loc;
210 MUMPS_INT i;
211 myid_loc=(MUMPS_INT)*_myid;
212 async_loc=(MUMPS_INT)*async;
213 total_size_io_loc=(long long)*total_size_io;
214 size_element_loc=(MUMPS_INT)*size_element;
215 nb_file_type_loc=(MUMPS_INT)*nb_file_type;
216 flag_tab_loc=(MUMPS_INT *)malloc(nb_file_type_loc*sizeof(MUMPS_INT));
217 for (i=0;i<nb_file_type_loc;i++){
218 flag_tab_loc[i]=(MUMPS_INT)flag_tab[i];
219 }
220#if defined(MUMPS_WIN32)
221 if(async_loc==IO_ASYNC_AIO||async_loc==IO_ASYNC_TH){
223 *ierr=-92;
224 mumps_io_error((MUMPS_INT)*ierr,"Error: Forbidden value of Async flag with _WIN32\n");
225 free(flag_tab_loc);
226 return;
227 }
228#endif
229#if defined (WITHOUT_PTHREAD)
230 if(async_loc==IO_ASYNC_TH){
232 *ierr=-92;
233 mumps_io_error((MUMPS_INT)*ierr,"Error: Forbidden value of Async flag with WITHOUT_PTHREAD\n");
234 free(flag_tab_loc);
235 return;
236 }
237#endif
238 total_vol=0;
239 mumps_io_flag_async=async_loc;
242 *ierr=-92;
243 mumps_io_error((MUMPS_INT)*ierr,"Error: prefix not initialized\n");
244 free(flag_tab_loc);
245 return;
246 }
248 *ierr=-92;
249 mumps_io_error((MUMPS_INT)*ierr,"Error: tmpdir not initialized\n");
250 free(flag_tab_loc);
251 return;
252 }
255 if(*ierr<0){
256 free(flag_tab_loc);
257 return;
258 }
259 /* Re-initialize lenghts to -1 in order to enable the
260 * check on initialization next time this routine is called
261 */
264 *ierr=(MUMPS_INT)mumps_init_file_structure(&myid_loc,&total_size_io_loc,&size_element_loc,&nb_file_type_loc,flag_tab_loc);
265 free(flag_tab_loc);
266 if(*ierr<0){
267 return;
268 }
269#if ! defined(MUMPS_WIN32)
271#endif
272 if(async_loc){
273 switch(async_loc){
274 case IO_SYNC:
275 printf("mumps_low_level_init_ooc_c should not be called with strategy %d\n",(int)mumps_io_flag_async);
276 break;
277#if ! defined(MUMPS_WIN32) && ! defined(WITHOUT_PTHREAD)
278 case IO_ASYNC_TH:
279 mumps_low_level_init_ooc_c_th(&async_loc,&ierr_loc);
280 *ierr=(MUMPS_INT)ierr_loc;
281 if(*ierr<0){
282 return;
283 }
284 break;
285#endif
286 default:
287 *ierr=-92;
288 sprintf(buf,"Error: unknown I/O strategy : %d\n",(int)*async);
289 mumps_io_error((MUMPS_INT)*ierr,buf);
290 return;
291 }
292 }
294 return;
295}
double total_vol
Definition mumps_io.c:26
static char MUMPS_OOC_STORE_TMPDIR[MUMPS_OOC_TMPDIR_MAX_LENGTH]
Definition mumps_io.h:33
static MUMPS_INT MUMPS_OOC_STORE_TMPDIRLEN
Definition mumps_io.h:34
static char MUMPS_OOC_STORE_PREFIX[MUMPS_OOC_PREFIX_MAX_LENGTH]
Definition mumps_io.h:31
static MUMPS_INT MUMPS_OOC_STORE_PREFIXLEN
Definition mumps_io.h:32
MUMPS_INT mumps_init_file_structure(MUMPS_INT *_myid, long long *total_size_io, MUMPS_INT *size_element, MUMPS_INT *nb_file_type, MUMPS_INT *flag_tab)
MUMPS_INT mumps_init_file_name(char *mumps_dir, char *mumps_file, MUMPS_INT *mumps_dim_dir, MUMPS_INT *mumps_dim_file, MUMPS_INT *_myid)
MUMPS_INT mumps_io_k211
#define IO_ASYNC_AIO
MUMPS_INT mumps_low_level_init_ooc_c_th(MUMPS_INT *async, MUMPS_INT *ierr)

◆ MUMPS_LOW_LEVEL_INIT_PREFIX()

void MUMPS_CALL MUMPS_LOW_LEVEL_INIT_PREFIX ( MUMPS_INT * dim,
char * str,
mumps_ftnlen l1 )

Inits the I/O OOC mechanism. Because on some computers, file size is limited, the I/O mechanism must be able to handle a multi-file access to data. Hence, we compute mumps_io_nb_file, which is the the number of files we estimate we need. Because of not exact matching between data packets written and size of files, the recoverment may be imperfect. Consequently, we must be able to reallocate if necessary.

Definition at line 173 of file mumps_io.c.

174{
175 MUMPS_INT i;
177 if( *dim > MUMPS_OOC_PREFIX_MAX_LENGTH )
179 for(i=0;i<MUMPS_OOC_STORE_PREFIXLEN;i++){
180 MUMPS_OOC_STORE_PREFIX[i]=str[i];
181 }
182 return;
183}
#define MUMPS_OOC_PREFIX_MAX_LENGTH
Definition mumps_io.h:29

◆ MUMPS_LOW_LEVEL_INIT_TMPDIR()

void MUMPS_CALL MUMPS_LOW_LEVEL_INIT_TMPDIR ( MUMPS_INT * dim,
char * str,
mumps_ftnlen l1 )

Definition at line 185 of file mumps_io.c.

186{
187 MUMPS_INT i;
189 if( *dim > MUMPS_OOC_TMPDIR_MAX_LENGTH )
191 for(i=0;i<MUMPS_OOC_STORE_TMPDIRLEN;i++){
192 MUMPS_OOC_STORE_TMPDIR[i]=str[i];
193 }
194 return;
195}
#define MUMPS_OOC_TMPDIR_MAX_LENGTH
Definition mumps_io.h:30

◆ MUMPS_LOW_LEVEL_READ_OOC_C()

void MUMPS_CALL MUMPS_LOW_LEVEL_READ_OOC_C ( const MUMPS_INT * strat_IO,
void * address_block,
MUMPS_INT * block_size_int1,
MUMPS_INT * block_size_int2,
MUMPS_INT * inode,
MUMPS_INT * request_arg,
MUMPS_INT * type,
MUMPS_INT * vaddr_int1,
MUMPS_INT * vaddr_int2,
MUMPS_INT * ierr )

Reads a contigous block of central memory from the disk.

Definition at line 367 of file mumps_io.c.

377{
378 char buf[64]; /* for error message */
379 long long vaddr,block_size;
380 MUMPS_INT inode_loc,request_arg_loc,type_loc,ierr_loc,strat_IO_loc;
381#if ! defined(MUMPS_WIN32)
382 struct timeval start_time,end_time;
383 gettimeofday(&start_time,NULL);
384#endif
385 inode_loc=(MUMPS_INT)*inode;
386 request_arg_loc=(MUMPS_INT)*request_arg;
387 type_loc=(MUMPS_INT)*type;
388 ierr_loc=(MUMPS_INT)*ierr;
389 strat_IO_loc=(MUMPS_INT)*strat_IO;
390 mumps_convert_2fint_to_longlong(vaddr_int1,vaddr_int2,&vaddr);
391 mumps_convert_2fint_to_longlong(block_size_int1,block_size_int2,&block_size);
393 switch(*strat_IO){
394#if ! defined(MUMPS_WIN32) && ! defined(WITHOUT_PTHREAD)
395 case IO_ASYNC_TH:
396 mumps_async_read_th(&strat_IO_loc,address_block,block_size,&inode_loc,&request_arg_loc,&type_loc,vaddr,&ierr_loc);
397 *ierr=(MUMPS_INT)ierr_loc;
398 *request_arg=(MUMPS_INT)request_arg_loc;
399 break;
400#endif
401 default:
402 *ierr=-91;
403 sprintf(buf,"Error: unknown I/O strategy : %d\n",(int)*strat_IO);
404 mumps_io_error((MUMPS_INT)*ierr,buf);
405 return;
406 }
407 }else{
408 mumps_io_do_read_block(address_block,block_size,&type_loc,vaddr,&ierr_loc);
409 *ierr=(MUMPS_INT)ierr_loc;
410 *request_arg=1;
411 }
412#if ! defined(MUMPS_WIN32)
413 gettimeofday(&end_time,NULL);
414 mumps_time_spent_in_sync=mumps_time_spent_in_sync+((double)end_time.tv_sec+((double)end_time.tv_usec/1000000))-((double)start_time.tv_sec+((double)start_time.tv_usec/1000000));
415#endif
416 read_op_vol=read_op_vol+((double)(block_size)*(double)mumps_elementary_data_size);
417 return;
418}
MUMPS_INT mumps_async_read_th(const MUMPS_INT *strat_IO, void *address_block, long long block_size, MUMPS_INT *inode, MUMPS_INT *request_arg, MUMPS_INT *type, long long vaddr, MUMPS_INT *ierr)

◆ MUMPS_LOW_LEVEL_WRITE_OOC_C()

void MUMPS_CALL MUMPS_LOW_LEVEL_WRITE_OOC_C ( const MUMPS_INT * strat_IO,
void * address_block,
MUMPS_INT * block_size_int1,
MUMPS_INT * block_size_int2,
MUMPS_INT * inode,
MUMPS_INT * request_arg,
MUMPS_INT * type,
MUMPS_INT * vaddr_int1,
MUMPS_INT * vaddr_int2,
MUMPS_INT * ierr )

Writes a contigous block of central memory to the disk.

Definition at line 300 of file mumps_io.c.

310{
311 MUMPS_INT ret_code=0;
312 long long vaddr,block_size;
313 char buf[64]; /* for error message */
314 MUMPS_INT inode_loc,request_arg_loc,type_loc,ierr_loc,strat_IO_loc;
315#if ! defined(MUMPS_WIN32)
316 struct timeval start_time,end_time;
317 gettimeofday(&start_time,NULL);
318#endif
319 inode_loc=(MUMPS_INT)*inode;
320 request_arg_loc=(MUMPS_INT)*request_arg;
321 type_loc=(MUMPS_INT)*type;
322 ierr_loc=(MUMPS_INT)*ierr;
323 strat_IO_loc=(MUMPS_INT)*strat_IO;
324/* JY 27/2/08: initialize *request_arg to -1 (null request).
325 * There were problems of uninitialized requests in the Fortran
326 * code. For example when we use the synchronous version, there are
327 * still some tests on *request_arg, which is not initialized.*/
328 *request_arg=-1;
329 mumps_convert_2fint_to_longlong(vaddr_int1,vaddr_int2,&vaddr);
330 mumps_convert_2fint_to_longlong(block_size_int1,block_size_int2,&block_size);
332 switch(*strat_IO){
333#if ! defined(MUMPS_WIN32) && ! defined(WITHOUT_PTHREAD)
334 case IO_ASYNC_TH:
335 ret_code=mumps_async_write_th(&strat_IO_loc, address_block, block_size,&inode_loc,&request_arg_loc,&type_loc,vaddr,&ierr_loc);
336 *ierr=(MUMPS_INT)ierr_loc;
337 *request_arg=(MUMPS_INT)request_arg_loc;
338 if(ret_code<0){
339 *ierr=ret_code;
340 }
341 break;
342#endif
343 default:
344 *ierr=-91;
345 sprintf(buf,"Error: unknown I/O strategy : %d\n",(int)*strat_IO);
346 mumps_io_error((MUMPS_INT)*ierr,buf);
347 return;
348 }
349 } else {
350 ret_code=mumps_io_do_write_block(address_block,block_size,&type_loc,vaddr,&ierr_loc);
351 *ierr=(MUMPS_INT)ierr_loc;
352 if(ret_code<0){
353 *ierr=ret_code;
354 }
355 }
356#if ! defined(MUMPS_WIN32)
357 gettimeofday(&end_time,NULL);
358 mumps_time_spent_in_sync=mumps_time_spent_in_sync+((double)end_time.tv_sec+((double)end_time.tv_usec/1000000))-((double)start_time.tv_sec+((double)start_time.tv_usec/1000000));
359#endif
360 write_op_vol=write_op_vol+((double)(block_size)*(double)mumps_elementary_data_size);
361 return;
362}
double write_op_vol
Definition mumps_io.c:26
MUMPS_INT mumps_io_do_write_block(void *address_block, long long block_size, MUMPS_INT *type_arg, long long vaddr, MUMPS_INT *ierr)
MUMPS_INT mumps_async_write_th(const MUMPS_INT *strat_IO, void *address_block, long long block_size, MUMPS_INT *inode, MUMPS_INT *request_arg, MUMPS_INT *type, long long vaddr, MUMPS_INT *ierr)

◆ MUMPS_OOC_ALLOC_POINTERS_C()

void MUMPS_CALL MUMPS_OOC_ALLOC_POINTERS_C ( MUMPS_INT * nb_file_type,
MUMPS_INT * dim,
MUMPS_INT * ierr )

Definition at line 562 of file mumps_io.c.

563{
564 MUMPS_INT i=0;
565 MUMPS_INT nb_file_type_loc, *dim_loc;
566 nb_file_type_loc=(MUMPS_INT)*nb_file_type;
567 dim_loc=(MUMPS_INT *)malloc(*nb_file_type*sizeof(MUMPS_INT));
568 for(i=0;i<nb_file_type_loc;i++){
569 dim_loc[i]=(MUMPS_INT)dim[i];
570 }
571 *ierr=(MUMPS_INT)mumps_io_alloc_pointers(&nb_file_type_loc,dim_loc);
572 for(i=0;i<nb_file_type_loc;i++){
573 mumps_io_set_last_file(dim_loc+i,&i);
574 }
575 free(dim_loc);
576 return;
577}
MUMPS_INT mumps_io_set_last_file(MUMPS_INT *dim, MUMPS_INT *type)
MUMPS_INT mumps_io_alloc_pointers(MUMPS_INT *nb_file_type, MUMPS_INT *dim)

◆ MUMPS_OOC_END_WRITE_C()

void MUMPS_CALL MUMPS_OOC_END_WRITE_C ( MUMPS_INT * ierr)

Definition at line 646 of file mumps_io.c.

647{
648 return;
649}

◆ MUMPS_OOC_GET_FILE_NAME_C()

void MUMPS_CALL MUMPS_OOC_GET_FILE_NAME_C ( MUMPS_INT * type,
MUMPS_INT * indice,
MUMPS_INT * length,
char * name,
mumps_ftnlen l1 )

Definition at line 541 of file mumps_io.c.

542{
543 MUMPS_INT type_loc,indice_loc,length_loc;
544 type_loc=(MUMPS_INT)*type;
545 indice_loc=(MUMPS_INT)*indice;
546 mumps_io_get_file_name(&indice_loc,name,&length_loc,&type_loc);
547 *length=(MUMPS_INT)length_loc;
548 return;
549}
MUMPS_INT mumps_io_get_file_name(MUMPS_INT *indice, char *name, MUMPS_INT *length, MUMPS_INT *type)

◆ MUMPS_OOC_GET_NB_FILES_C()

void MUMPS_CALL MUMPS_OOC_GET_NB_FILES_C ( const MUMPS_INT * type,
MUMPS_INT * nb_files )

Definition at line 532 of file mumps_io.c.

533{
534 MUMPS_INT type_loc,nb_files_loc;
535 type_loc=(MUMPS_INT)*type;
536 mumps_io_get_nb_files(&nb_files_loc,&type_loc);
537 *nb_files=(MUMPS_INT)nb_files_loc;
538 return;
539}
MUMPS_INT mumps_io_get_nb_files(MUMPS_INT *nb_files, const MUMPS_INT *type)

◆ MUMPS_OOC_INIT_VARS_C()

void MUMPS_CALL MUMPS_OOC_INIT_VARS_C ( MUMPS_INT * myid_arg,
MUMPS_INT * size_element,
MUMPS_INT * async,
MUMPS_INT * k211,
MUMPS_INT * ierr )

Definition at line 579 of file mumps_io.c.

582{
583 MUMPS_INT size_element_loc,async_loc,myid_arg_loc;
584#if ! defined(MUMPS_WIN32) && ! defined(WITHOUT_PTHREAD)
586#endif
588 size_element_loc=(MUMPS_INT)*size_element;
589 async_loc=(MUMPS_INT)*async;
590 myid_arg_loc=(MUMPS_INT)*myid_arg;
591 *ierr=(MUMPS_INT)mumps_io_init_vars(&myid_arg_loc,&size_element_loc,&async_loc);
592 return;
593}
MUMPS_INT mumps_io_init_vars(MUMPS_INT *myid_arg, MUMPS_INT *size_element, MUMPS_INT *async_arg)

◆ MUMPS_OOC_IS_ASYNC_AVAIL()

void MUMPS_CALL MUMPS_OOC_IS_ASYNC_AVAIL ( MUMPS_INT * flag)

Definition at line 651 of file mumps_io.c.

652{
653#if ( defined (WITHOUT_PTHREAD) || defined(MUMPS_WIN32) ) && ! defined(WITH_AIO)
654 *flag=0;
655#else
656 *flag=1;
657#endif
658}
*fortran !University of Stuttgart All rights reserved Inc All rights reserved ! $COPYRIGHT$ !Additional copyrights may follow ! $HEADER$ !WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING !Do ***not ***copy this file to the directory where your Fortran !fortran application is compiled unless it is absolutely necessary !Most !modern Fortran compilers now support the I command line flag
Definition mpif.h:26

◆ MUMPS_OOC_PRINT_STATS()

void MUMPS_CALL MUMPS_OOC_PRINT_STATS ( )

Definition at line 492 of file mumps_io.c.

493{
494#if ! defined(MUMPS_WIN32)
495 printf("%d: total time spent in i/o mode = %lf\n",(int)mumps_io_myid,mumps_time_spent_in_sync);
496#endif
497 printf("%d: Volume of read i/o = %lf\n",(int)mumps_io_myid,read_op_vol);
498 printf("%d: Volume of write i/o = %lf\n",(int)mumps_io_myid,write_op_vol);
500 printf("%d: Total i/o volume = %lf\n",(int)mumps_io_myid,total_vol);
501 return;
502}
MUMPS_INT mumps_io_myid

◆ MUMPS_OOC_REMOVE_FILE_C()

void MUMPS_CALL MUMPS_OOC_REMOVE_FILE_C ( MUMPS_INT * ierr,
char * name,
mumps_ftnlen l1 )

Definition at line 629 of file mumps_io.c.

630{
631 char buf[256]; /* for error message, count 256 chars for name */
632 *ierr=(MUMPS_INT)remove(name);
633 if(*ierr<0){
634#if ! defined(MUMPS_WIN32)
635 sprintf(buf,"Unable to remove OOC file %s",name);
636#else
637 sprintf(buf,"Unable to remove OOC file %s with return value %d",name,*ierr);
638#endif
639 *ierr = -90;
640 mumps_io_sys_error((MUMPS_INT)*ierr,buf);
641 return;
642 }
643 return;
644}
MUMPS_INT mumps_io_sys_error(MUMPS_INT mumps_errno, const char *desc)

◆ MUMPS_OOC_SET_FILE_NAME_C()

void MUMPS_CALL MUMPS_OOC_SET_FILE_NAME_C ( MUMPS_INT * type,
MUMPS_INT * indice,
MUMPS_INT * length,
MUMPS_INT * ierr,
char * name,
mumps_ftnlen l1 )

Definition at line 551 of file mumps_io.c.

553{
554 MUMPS_INT type_loc,indice_loc,length_loc;
555 type_loc=(MUMPS_INT)*type;
556 indice_loc=(MUMPS_INT)*indice;
557 length_loc=(MUMPS_INT)*length;
558 *ierr=(MUMPS_INT)mumps_io_set_file_name(&indice_loc,name,&length_loc,&type_loc);
559 return;
560}
MUMPS_INT mumps_io_set_file_name(MUMPS_INT *indice, char *name, MUMPS_INT *length, MUMPS_INT *type)

◆ MUMPS_OOC_START_LOW_LEVEL()

void MUMPS_CALL MUMPS_OOC_START_LOW_LEVEL ( MUMPS_INT * ierr)

Definition at line 595 of file mumps_io.c.

596{
597 char buf[64]; /* for error message */
598 MUMPS_INT ierr_loc;
599 read_op_vol=0;
600 write_op_vol=0;
602 if(*ierr<0){
603 return;
604 }
606 switch(mumps_io_flag_async){
607 case IO_SYNC:
608 break;
609#if ! defined(MUMPS_WIN32) && ! defined(WITHOUT_PTHREAD)
610 case IO_ASYNC_TH:
612 *ierr=(MUMPS_INT)ierr_loc;
613 if(*ierr<0){
614 return;
615 }
616 break;
617#endif
618 default:
619 *ierr=-91;
620 sprintf(buf,"Error: unknown I/O strategy : %d\n",(int)mumps_io_flag_async);
621 mumps_io_error((MUMPS_INT)*ierr,buf);
622 return;
623 }
624 }
626 return;
627}
MUMPS_INT mumps_io_open_files_for_read()

◆ MUMPS_TEST_REQUEST_C()

void MUMPS_CALL MUMPS_TEST_REQUEST_C ( MUMPS_INT * request_id,
MUMPS_INT * flag,
MUMPS_INT * ierr )

Definition at line 87 of file mumps_io.c.

88{
89 char buf[64]; /* for error message */
90 MUMPS_INT request_id_loc;
91#if ! defined(MUMPS_WIN32) && ! defined(WITHOUT_PTHREAD)
92 MUMPS_INT flag_loc;
93#endif
94#if ! defined(MUMPS_WIN32)
95 struct timeval start_time,end_time;
96 gettimeofday(&start_time,NULL);
97#endif
98 request_id_loc=(MUMPS_INT)*request_id;
99 switch(mumps_io_flag_async){
100 case IO_SYNC:
101 /* printf("mumps_test_request_c should not be called with strategy %d\n",mumps_io_flag_async);*/
102 /* JY+EA: Allow for this option, since it is similar to wait_request
103 * and wait_request is allowed in synchronous mode.
104 * We always return TRUE.
105 */
106 *flag=1;
107 break;
108#if ! defined(MUMPS_WIN32) && ! defined(WITHOUT_PTHREAD)
109 case IO_ASYNC_TH:
110 *ierr=(MUMPS_INT)mumps_test_request_th(&request_id_loc,&flag_loc);
111 *flag=(MUMPS_INT)flag_loc;
112 break;
113#endif
114 default:
115 *ierr=-92;
116 sprintf(buf,"Error: unknown I/O strategy : %d\n",(int)mumps_io_flag_async);
117 mumps_io_error((MUMPS_INT)*ierr,buf);
118 return;
119 }
120#if ! defined(MUMPS_WIN32)
121 gettimeofday(&end_time,NULL);
122 mumps_time_spent_in_sync=mumps_time_spent_in_sync+((double)end_time.tv_sec+((double)end_time.tv_usec/1000000))-((double)start_time.tv_sec+((double)start_time.tv_usec/1000000));
123#endif
124 return;
125}
MUMPS_INT mumps_test_request_th(MUMPS_INT *request_id, MUMPS_INT *flag)

◆ MUMPS_WAIT_REQUEST()

void MUMPS_CALL MUMPS_WAIT_REQUEST ( MUMPS_INT * request_id,
MUMPS_INT * ierr )

Definition at line 128 of file mumps_io.c.

129{
130 char buf[64]; /* for error message */
131 MUMPS_INT request_id_loc;
132#if ! defined(MUMPS_WIN32)
133 struct timeval start_time,end_time;
134 gettimeofday(&start_time,NULL);
135#endif
136 request_id_loc=(MUMPS_INT)*request_id;
137 if(*request_id==-1)
138 return;
139 switch(mumps_io_flag_async){
140 case IO_SYNC:
141 /* printf("mumps_wait_request should not be called with strategy %d\n",mumps_io_flag_async); */
142 break;
143#if ! defined(MUMPS_WIN32) && ! defined(WITHOUT_PTHREAD)
144 case IO_ASYNC_TH:
145 *ierr=(MUMPS_INT)mumps_wait_request_th(&request_id_loc);
146 break;
147#endif
148 default:
149 *ierr=-92;
150 sprintf(buf,"Error: unknown I/O strategy : %d\n",(int)mumps_io_flag_async);
151 mumps_io_error((MUMPS_INT)*ierr,buf);
152 return;
153 /* printf("Error: unknown I/O strategy : %d\n",mumps_io_flag_async);
154 exit (-3);*/
155 }
156#if ! defined(MUMPS_WIN32)
157 gettimeofday(&end_time,NULL);
158 mumps_time_spent_in_sync=mumps_time_spent_in_sync+((double)end_time.tv_sec+((double)end_time.tv_usec/1000000))-((double)start_time.tv_sec+((double)start_time.tv_usec/1000000));
159#endif
160 return;
161}
MUMPS_INT mumps_wait_request_th(MUMPS_INT *request_id)

Variable Documentation

◆ mumps_time_spent_in_sync

double mumps_time_spent_in_sync

Definition at line 24 of file mumps_io.c.

◆ read_op_vol

double read_op_vol

Definition at line 26 of file mumps_io.c.

◆ total_vol

double total_vol

Definition at line 26 of file mumps_io.c.

◆ write_op_vol

double write_op_vol

Definition at line 26 of file mumps_io.c.