1 /* 2 * 3 * This file is part of MUMPS 4.10.0, built on Tue May 10 12:56:32 UTC 2011 4 * 5 * 6 * This version of MUMPS is provided to you free of charge. It is public 7 * domain, based on public domain software developed during the Esprit IV 8 * European project PARASOL (1996-1999). Since this first public domain 9 * version in 1999, research and developments have been supported by the 10 * following institutions: CERFACS, CNRS, ENS Lyon, INPT(ENSEEIHT)-IRIT, 11 * INRIA, and University of Bordeaux. 12 * 13 * The MUMPS team at the moment of releasing this version includes 14 * Patrick Amestoy, Maurice Bremond, Alfredo Buttari, Abdou Guermouche, 15 * Guillaume Joslin, Jean-Yves L'Excellent, Francois-Henry Rouet, Bora 16 * Ucar and Clement Weisbecker. 17 * 18 * We are also grateful to Emmanuel Agullo, Caroline Bousquet, Indranil 19 * Chowdhury, Philippe Combes, Christophe Daniel, Iain Duff, Vincent Espirat, 20 * Aurelia Fevre, Jacko Koster, Stephane Pralet, Chiara Puglisi, Gregoire 21 * Richard, Tzvetomila Slavova, Miroslav Tuma and Christophe Voemel who 22 * have been contributing to this project. 23 * 24 * Up-to-date copies of the MUMPS package can be obtained 25 * from the Web pages: 26 * http://mumps.enseeiht.fr/ or http://graal.ens-lyon.fr/MUMPS 27 * 28 * 29 * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY 30 * EXPRESSED OR IMPLIED. ANY USE IS AT YOUR OWN RISK. 31 * 32 * 33 * User documentation of any code that uses this software can 34 * include this complete notice. You can acknowledge (using 35 * references [1] and [2]) the contribution of this package 36 * in any scientific publication dependent upon the use of the 37 * package. You shall use reasonable endeavours to notify 38 * the authors of the package of this publication. 39 * 40 * [1] P. R. Amestoy, I. S. Duff, J. Koster and J.-Y. L'Excellent, 41 * A fully asynchronous multifrontal solver using distributed dynamic 42 * scheduling, SIAM Journal of Matrix Analysis and Applications, 43 * Vol 23, No 1, pp 15-41 (2001). 44 * 45 * [2] P. R. Amestoy and A. Guermouche and J.-Y. L'Excellent and 46 * S. Pralet, Hybrid scheduling for the parallel solution of linear 47 * systems. Parallel Computing Vol 32 (2), pp 136-156 (2006). 48 * 49 */ 50 #ifndef MUMPS_IO_THREAD_H 51 #define MUMPS_IO_THREAD_H 52 #include "mumps_compat.h" 53 #if ! defined (MUMPS_WIN32) && ! defined (WITHOUT_PTHREAD) 54 # include <unistd.h> 55 # include <pthread.h> 56 # include <sys/types.h> 57 # include <sys/time.h> 58 # include <time.h> 59 # define MAX_IO 20 60 # define MAX_FINISH_REQ 40 61 # define IO_FLAG_STOP 1 62 # define IO_FLAG_RUN 0 63 # define IO_READ 1 64 # define IO_WRITE 0 65 struct request_io{ 66 int inode; 67 int req_num; /*request number*/ 68 void* addr; /*memory address (either source or dest)*/ 69 long long size; /* size of the requested io (unit=size of elementary mumps data)*/ 70 long long vaddr; /* virtual address for file management */ 71 int io_type; /*read or write*/ 72 int file_type; /* cb or lu or ... */ 73 pthread_cond_t local_cond; 74 int int_local_cond; 75 }; 76 /* Exported global variables */ 77 extern int io_flag_stop,current_req_num; 78 extern pthread_t io_thread,main_thread; 79 extern pthread_mutex_t io_mutex; 80 extern pthread_cond_t cond_io,cond_nb_free_finished_requests,cond_nb_free_active_requests,cond_stop; 81 extern pthread_mutex_t io_mutex_cond; 82 extern int int_sem_io,int_sem_nb_free_finished_requests,int_sem_nb_free_active_requests,int_sem_stop; 83 extern int with_sem; 84 extern struct request_io *io_queue; 85 extern int first_active,last_active,nb_active; 86 extern int *finished_requests_inode,*finished_requests_id,first_finished_requests, 87 last_finished_requests,nb_finished_requests,smallest_request_id; 88 extern int mumps_owns_mutex; 89 extern int test_request_called_from_mumps; 90 /* Exported functions */ 91 void* mumps_async_thread_function_with_sem (void* arg); 92 int mumps_is_there_finished_request_th(int* flag); 93 int mumps_clean_request_th(int* request_id); 94 int mumps_wait_req_sem_th(int *request_id); 95 int mumps_test_request_th(int* request_id,int *flag); 96 int mumps_wait_request_th(int *request_id); 97 int mumps_low_level_init_ooc_c_th(int* async, int* ierr); 98 int mumps_async_write_th(const int * strat_IO,void * address_block,long long block_size, 99 int * inode,int * request_arg,int * type,long long vaddr,int * ierr); 100 int mumps_async_read_th(const int * strat_IO,void * address_block,long long block_size,int * inode,int * request_arg, 101 int * type,long long vaddr,int * ierr); 102 int mumps_clean_io_data_c_th(int *myid); 103 int mumps_get_sem(void *arg,int *value); 104 int mumps_wait_sem(void *arg,pthread_cond_t *cond); 105 int mumps_post_sem(void *arg,pthread_cond_t *cond); 106 int mumps_clean_finished_queue_th(); 107 #endif /*_WIN32 && WITHOUT_PTHREAD*/ 108 #endif /* MUMPS_IO_THREAD_H */ 109