Exemplo n.º 1
0
/**
 * Writes a contigous block of central memory to the disk.
 */
void MUMPS_CALL
MUMPS_LOW_LEVEL_WRITE_OOC_C(const int * strat_IO,
                            void * address_block,
                            int * block_size_int1,
                            int * block_size_int2,
                            int * inode,
                            int * request_arg,
                            int * type,
                            int * vaddr_int1,
                            int * vaddr_int2,
                            int * ierr)
{
  int ret_code=0;
  long long vaddr,block_size;
  char buf[64]; /* for error message */
#if ! defined(MUMPS_WIN32)
  struct timeval start_time,end_time;
  gettimeofday(&start_time,NULL);
#endif
/* JY 27/2/08: initialize *request_arg to -1 (null request).
 * There were problems of uninitialized requests in the Fortran
 * code. For example when we use the synchronous version, there are
 * still some tests on *request_arg, which is not initialized.*/
  *request_arg=-1;
  mumps_convert_2fint_to_longlong(vaddr_int1,vaddr_int2,&vaddr);
  mumps_convert_2fint_to_longlong(block_size_int1,block_size_int2,&block_size);
  if(mumps_io_flag_async){
    switch(*strat_IO){
#if ! defined(MUMPS_WIN32) && ! defined(WITHOUT_PTHREAD)
    case IO_ASYNC_TH:
      ret_code=mumps_async_write_th(strat_IO, address_block, block_size,inode,request_arg,type,vaddr,ierr);
      if(ret_code<0){
        *ierr=ret_code;
      }
      break;
#endif
    default:
      *ierr=-91;
      sprintf(buf,"Error: unknown I/O strategy : %d\n",*strat_IO);
      mumps_io_error(*ierr,buf);
      return;
    }
  } else {
    ret_code=mumps_io_do_write_block(address_block,block_size,type,vaddr,ierr);
    if(ret_code<0){
      *ierr=ret_code;
    }
  }
#if ! defined(MUMPS_WIN32)
  gettimeofday(&end_time,NULL);
  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));
#endif
  write_op_vol=write_op_vol+((double)(block_size)*(double)mumps_elementary_data_size);
  return;
}
Exemplo n.º 2
0
/**
 * Reads  a contigous block of central memory from the disk.
 */
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)
{
  char buf[64]; /* for error message */
  long long vaddr,block_size;
  int inode_loc,request_arg_loc,type_loc,ierr_loc,strat_IO_loc;
#if ! defined(MUMPS_WIN32)
  struct timeval start_time,end_time;
  gettimeofday(&start_time,NULL);
#endif
  inode_loc=(int)*inode;
  request_arg_loc=(int)*request_arg;
  type_loc=(int)*type;
  ierr_loc=(int)*ierr;
  strat_IO_loc=(int)*strat_IO;  
  mumps_convert_2fint_to_longlong(vaddr_int1,vaddr_int2,&vaddr);
  mumps_convert_2fint_to_longlong(block_size_int1,block_size_int2,&block_size);
  if(mumps_io_flag_async){
      switch(*strat_IO){
#if ! defined(MUMPS_WIN32) && ! defined(WITHOUT_PTHREAD)
      case IO_ASYNC_TH:
        mumps_async_read_th(&strat_IO_loc,address_block,block_size,&inode_loc,&request_arg_loc,&type_loc,vaddr,&ierr_loc);
	*ierr=(MUMPS_INT)ierr_loc;
	*request_arg=(MUMPS_INT)request_arg_loc;
        break;
#endif
      default:
        *ierr=-91;
        sprintf(buf,"Error: unknown I/O strategy : %d\n",(int)*strat_IO);
        mumps_io_error((int)*ierr,buf);
        return;
      }
  }else{
    mumps_io_do_read_block(address_block,block_size,&type_loc,vaddr,&ierr_loc);
    *ierr=(MUMPS_INT)ierr_loc;
    *request_arg=1;
  }
#if ! defined(MUMPS_WIN32)
  gettimeofday(&end_time,NULL);
  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));
#endif
  read_op_vol=read_op_vol+((double)(block_size)*(double)mumps_elementary_data_size);
  return;
}
Exemplo n.º 3
0
/* Emergency read from the MUMPS thread during the solve phase.*/
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)
{
    /*  int ret_code=0; */
  long long vaddr,block_size;
  int type_loc,ierr_loc;
#if ! defined(MUMPS_WIN32)
  struct timeval start_time,end_time;
  gettimeofday(&start_time,NULL);
#endif
  type_loc=(int)*type;
  mumps_convert_2fint_to_longlong(vaddr_int1,vaddr_int2,&vaddr);
  mumps_convert_2fint_to_longlong(block_size_int1,block_size_int2,&block_size);
#if ! defined(MUMPS_WIN32) && ! defined(WITHOUT_PTHREAD)
    if(mumps_io_flag_async==IO_ASYNC_TH||mumps_io_flag_async==0)
#else
    if(mumps_io_flag_async==0)
#endif
    {
      ierr_loc=mumps_io_do_read_block(address_block,block_size,&type_loc,vaddr,&ierr_loc);
      *ierr=(MUMPS_INT)ierr_loc;
      if(*ierr<0){
         return;
      }
    } else {
    }
#if ! defined(MUMPS_WIN32)
# if ! defined(WITHOUT_PTHREAD)
# endif
  gettimeofday(&end_time,NULL);
  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));
#endif
  read_op_vol=read_op_vol+((double)(block_size)*(double)mumps_elementary_data_size);
  return;
}