123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506 |
- /*
- * -- High Performance Computing Linpack Benchmark (HPL)
- * HPL - 2.0 - September 10, 2008
- * Antoine P. Petitet
- * University of Tennessee, Knoxville
- * Innovative Computing Laboratory
- * (C) Copyright 2000-2008 All Rights Reserved
- *
- * -- Copyright notice and Licensing terms:
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions, and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * 3. All advertising materials mentioning features or use of this
- * software must display the following acknowledgement:
- * This product includes software developed at the University of
- * Tennessee, Knoxville, Innovative Computing Laboratory.
- *
- * 4. The name of the University, the name of the Laboratory, or the
- * names of its contributors may not be used to endorse or promote
- * products derived from this software without specific written
- * permission.
- *
- * -- Disclaimer:
- *
- * 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 UNIVERSITY
- * 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.
- */
- #ifndef HPL_PAUXIL_H
- #define HPL_PAUXIL_H
- /*
- * ---------------------------------------------------------------------
- * Include files
- * ---------------------------------------------------------------------
- */
- #include "hpl_misc.h"
- #include "hpl_blas.h"
- #include "hpl_auxil.h"
- #include "hpl_pmisc.h"
- #include "hpl_grid.h"
- /*
- * ---------------------------------------------------------------------
- * #define macros definitions
- * ---------------------------------------------------------------------
- */
- /*
- * Mindxg2p returns the process coodinate owning the entry globally in-
- * dexed by ig_.
- */
- #define Mindxg2p( ig_, inb_, nb_, proc_, src_, nprocs_ ) \
- { \
- if( ( (ig_) >= (inb_) ) && ( (src_) >= 0 ) && \
- ( (nprocs_) > 1 ) ) \
- { \
- proc_ = (src_) + 1 + ( (ig_)-(inb_) ) / (nb_); \
- proc_ -= ( proc_ / (nprocs_) ) * (nprocs_); \
- } \
- else \
- { \
- proc_ = (src_); \
- } \
- }
- #define Mindxg2l( il_, ig_, inb_, nb_, proc_, src_, nprocs_ ) \
- { \
- if( ( (ig_) < (inb_) ) || ( (src_) == -1 ) || \
- ( (nprocs_) == 1 ) ) { il_ = (ig_); } \
- else \
- { \
- int i__, j__; \
- j__ = ( i__ = ( (ig_)-(inb_) ) / (nb_) ) / (nprocs_); \
- il_ = (nb_)*( j__ - i__ ) + \
- ( (i__ + 1 - ( j__ + 1 ) * (nprocs_) ) ? \
- (ig_) - (inb_) : (ig_) ); \
- } \
- }
- #define Mindxg2lp( il_, proc_, ig_, inb_, nb_, src_, nprocs_ ) \
- { \
- if( ( (ig_) < (inb_) ) || ( (src_) == -1 ) || \
- ( (nprocs_) == 1 ) ) \
- { il_ = (ig_); proc_ = (src_); } \
- else \
- { \
- int i__, j__; \
- j__ = ( i__ = ( (ig_)-(inb_) ) / (nb_) ) / (nprocs_); \
- il_ = (nb_)*(j__-i__) + \
- ( ( i__ + 1 - ( j__ + 1 ) * (nprocs_) ) ? \
- (ig_) - (inb_) : (ig_) ); \
- proc_ = (src_) + 1 + i__; \
- proc_ -= ( proc_ / (nprocs_) ) * (nprocs_); \
- } \
- }
- /*
- * Mindxl2g computes the global index ig_ corresponding to the local
- * index il_ in process proc_.
- */
- #define Mindxl2g( ig_, il_, inb_, nb_, proc_, src_, nprocs_ ) \
- { \
- if( ( (src_) >= 0 ) && ( (nprocs_) > 1 ) ) \
- { \
- if( (proc_) == (src_) ) \
- { \
- if( (il_) < (inb_) ) ig_ = (il_); \
- else ig_ = (il_) + \
- (nb_)*((nprocs_)-1)*(((il_)-(inb_))/(nb_) + 1); \
- } \
- else if( (proc_) < (src_) ) \
- { \
- ig_ = (il_) + (inb_) + \
- (nb_)*( ((nprocs_)-1)*((il_)/(nb_)) + \
- (proc_)-(src_)-1+(nprocs_) ); \
- } \
- else \
- { \
- ig_ = (il_) + (inb_) + \
- (nb_)*( ((nprocs_)-1)*((il_)/(nb_)) + \
- (proc_)-(src_)-1 ); \
- } \
- } \
- else \
- { \
- ig_ = (il_); \
- } \
- }
- /*
- * MnumrocI computes the # of local indexes np_ residing in the process
- * of coordinate proc_ corresponding to the interval of global indexes
- * i_:i_+n_-1 assuming that the global index 0 resides in the process
- * src_, and that the indexes are distributed from src_ using the para-
- * meters inb_, nb_ and nprocs_.
- */
- #define MnumrocI( np_, n_, i_, inb_, nb_, proc_, src_, nprocs_ ) \
- { \
- if( ( (src_) >= 0 ) && ( (nprocs_) > 1 ) ) \
- { \
- int inb__, mydist__, n__, nblk__, quot__, src__; \
- if( ( inb__ = (inb_) - (i_) ) <= 0 ) \
- { \
- nblk__ = (-inb__) / (nb_) + 1; \
- src__ = (src_) + nblk__; \
- src__ -= ( src__ / (nprocs_) ) * (nprocs_); \
- inb__ += nblk__*(nb_); \
- if( ( n__ = (n_) - inb__ ) <= 0 ) \
- { \
- if( (proc_) == src__ ) np_ = (n_); \
- else np_ = 0; \
- } \
- else \
- { \
- if( ( mydist__ = (proc_) - src__ ) < 0 ) \
- mydist__ += (nprocs_); \
- nblk__ = n__ / (nb_) + 1; \
- mydist__ -= nblk__ - \
- (quot__ = (nblk__ / (nprocs_))) * (nprocs_); \
- if( mydist__ < 0 ) \
- { \
- if( (proc_) != src__ ) \
- np_ = (nb_) + (nb_) * quot__; \
- else \
- np_ = inb__ + (nb_) * quot__; \
- } \
- else if( mydist__ > 0 ) \
- { \
- np_ = (nb_) * quot__; \
- } \
- else \
- { \
- if( (proc_) != src__ ) \
- np_ = n__ +(nb_)+(nb_)*(quot__ - nblk__); \
- else \
- np_ = (n_)+ (nb_)*(quot__ - nblk__); \
- } \
- } \
- } \
- else \
- { \
- if( ( n__ = (n_) - inb__ ) <= 0 ) \
- { \
- if( (proc_) == (src_) ) np_ = (n_); \
- else np_ = 0; \
- } \
- else \
- { \
- if( ( mydist__ = (proc_) - (src_) ) < 0 ) \
- mydist__ += (nprocs_); \
- nblk__ = n__ / (nb_) + 1; \
- mydist__ -= nblk__ - \
- ( quot__ = (nblk__ / (nprocs_)) )*(nprocs_); \
- if( mydist__ < 0 ) \
- { \
- if( (proc_) != (src_) ) \
- np_ = (nb_) + (nb_) * quot__; \
- else \
- np_ = inb__ + (nb_) * quot__; \
- } \
- else if( mydist__ > 0 ) \
- { \
- np_ = (nb_) * quot__; \
- } \
- else \
- { \
- if( (proc_) != (src_) ) \
- np_ = n__ +(nb_)+(nb_)*(quot__ - nblk__); \
- else \
- np_ = (n_)+ (nb_)*(quot__ - nblk__); \
- } \
- } \
- } \
- } \
- else \
- { \
- np_ = (n_); \
- } \
- }
- #define Mnumroc( np_, n_, inb_, nb_, proc_, src_, nprocs_ ) \
- MnumrocI( np_, n_, 0, inb_, nb_, proc_, src_, nprocs_ )
- /*
- * ---------------------------------------------------------------------
- * Function prototypes
- * ---------------------------------------------------------------------
- */
- void HPL_indxg2lp
- STDC_ARGS( (
- int *,
- int *,
- const int,
- const int,
- const int,
- const int,
- const int
- ) );
- int HPL_indxg2l
- STDC_ARGS( (
- const int,
- const int,
- const int,
- const int,
- const int
- ) );
- int HPL_indxg2p
- STDC_ARGS( (
- const int,
- const int,
- const int,
- const int,
- const int
- ) );
- int HPL_indxl2g
- STDC_ARGS( (
- const int,
- const int,
- const int,
- const int,
- const int,
- const int
- ) );
- void HPL_infog2l
- STDC_ARGS( (
- int,
- int,
- const int,
- const int,
- const int,
- const int,
- const int,
- const int,
- const int,
- const int,
- const int,
- const int,
- int *,
- int *,
- int *,
- int *
- ) );
- int HPL_numroc
- STDC_ARGS( (
- const int,
- const int,
- const int,
- const int,
- const int,
- const int
- ) );
- int HPL_numrocI
- STDC_ARGS( (
- const int,
- const int,
- const int,
- const int,
- const int,
- const int,
- const int
- ) );
- void HPL_dlaswp00N
- STDC_ARGS( (
- const int,
- const int,
- double *,
- const int,
- const int *
- ) );
- void HPL_dlaswp10N
- STDC_ARGS( (
- const int,
- const int,
- double *,
- const int,
- const int *
- ) );
- void HPL_dlaswp01N
- STDC_ARGS( (
- const int,
- const int,
- double *,
- const int,
- double *,
- const int,
- const int *,
- const int *
- ) );
- void HPL_dlaswp01T
- STDC_ARGS( (
- const int,
- const int,
- double *,
- const int,
- double *,
- const int,
- const int *,
- const int *
- ) );
- void HPL_dlaswp02N
- STDC_ARGS( (
- const int,
- const int,
- const double *,
- const int,
- double *,
- double *,
- const int,
- const int *,
- const int *
- ) );
- void HPL_dlaswp03N
- STDC_ARGS( (
- const int,
- const int,
- double *,
- const int,
- const double *,
- const double *,
- const int
- ) );
- void HPL_dlaswp03T
- STDC_ARGS( (
- const int,
- const int,
- double *,
- const int,
- const double *,
- const double *,
- const int
- ) );
- void HPL_dlaswp04N
- STDC_ARGS( (
- const int,
- const int,
- const int,
- double *,
- const int,
- double *,
- const int,
- const double *,
- const double *,
- const int,
- const int *,
- const int *
- ) );
- void HPL_dlaswp04T
- STDC_ARGS( (
- const int,
- const int,
- const int,
- double *,
- const int,
- double *,
- const int,
- const double *,
- const double *,
- const int,
- const int *,
- const int *
- ) );
- void HPL_dlaswp05N
- STDC_ARGS( (
- const int,
- const int,
- double *,
- const int,
- const double *,
- const int,
- const int *,
- const int *
- ) );
- void HPL_dlaswp05T
- STDC_ARGS( (
- const int,
- const int,
- double *,
- const int,
- const double *,
- const int,
- const int *,
- const int *
- ) );
- void HPL_dlaswp06N
- STDC_ARGS( (
- const int,
- const int,
- double *,
- const int,
- double *,
- const int,
- const int *
- ) );
- void HPL_dlaswp06T
- STDC_ARGS( (
- const int,
- const int,
- double *,
- const int,
- double *,
- const int,
- const int *
- ) );
- void HPL_pabort
- STDC_ARGS( (
- int,
- const char *,
- const char *,
- ...
- ) );
- void HPL_pwarn
- STDC_ARGS( (
- FILE *,
- int,
- const char *,
- const char *,
- ...
- ) );
- void HPL_pdlaprnt
- STDC_ARGS( (
- const HPL_T_grid *,
- const int,
- const int,
- const int,
- double *,
- const int,
- const int,
- const int,
- const char *
- ) );
- double HPL_pdlamch
- STDC_ARGS( (
- MPI_Comm,
- const HPL_T_MACH
- ) );
- double HPL_pdlange
- STDC_ARGS( (
- const HPL_T_grid *,
- const HPL_T_NORM,
- const int,
- const int,
- const int,
- const double *,
- const int
- ) );
- #endif
- /*
- * End of hpl_pauxil.h
- */
|