Changeset 1073


Ignore:
Timestamp:
03/15/17 17:17:30 (4 years ago)
Author:
yushan
Message:

add test_omp ; Using threads : modif for context_initialize

Location:
XIOS/dev/branch_yushan
Files:
1 added
12 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/branch_yushan/bld.cfg

    r1072 r1073  
    3636#bld::target test_remap.exe 
    3737#bld::target test_new_features.exe test_unstruct_complete.exe  
    38 bld::target test_omp.exe #test_complete.exe test_client.exe 
     38bld::target test_omp.exe test_client.exe #test_complete.exe  
    3939bld::exe_dep 
    4040 
  • XIOS/dev/branch_yushan/extern/remap/src/clipper.cpp

    r1072 r1073  
    5252 
    5353static double const pi = 3.141592653589793238; 
    54 #pragma omp threadprivate(pi) 
    5554 
    5655static double const two_pi = pi *2; 
    57 #pragma omp threadprivate(two_pi) 
    5856 
    5957static double const def_arc_tolerance = 0.25; 
    60 #pragma omp threadprivate(def_arc_tolerance) 
    6158 
    6259enum Direction { dRightToLeft, dLeftToRight }; 
    6360 
    6461static int const Unassigned = -1;  //edge not currently 'owning' a solution 
    65 #pragma omp threadprivate(Unassigned) 
    6662 
    6763static int const Skip = -2;        //edge that would otherwise close a path 
    68 #pragma omp threadprivate(Skip) 
    6964 
    7065#define HORIZONTAL (-1.0E+40) 
  • XIOS/dev/branch_yushan/extern/remap/src/clipper.hpp

    r1072 r1073  
    7373  typedef int cInt; 
    7474  static cInt const loRange = 0x7FFF; 
    75   #pragma omp threadprivate(loRange) 
    7675 
    7776  static cInt const hiRange = 0x7FFF; 
    78   #pragma omp threadprivate(hiRange) 
    7977 
    8078#else 
    8179  typedef signed long long cInt; 
    8280  static cInt const loRange = 0x3FFFFFFF; 
    83   #pragma omp threadprivate(loRange) 
    8481 
    8582  static cInt const hiRange = 0x3FFFFFFFFFFFFFFFLL; 
    86   #pragma omp threadprivate(hiRange) 
    8783   
    8884  typedef signed long long long64;     //used by Int128 class 
  • XIOS/dev/branch_yushan/extern/remap/src/timerRemap.hpp

    r1072 r1073  
    2727    void print(void); 
    2828    static map<string,CTimer*> allTimer; 
    29     //#pragma omp threadprivate(allTimer) 
    3029 
    3130    static double getTime(void); 
  • XIOS/dev/branch_yushan/src/client.cpp

    r1072 r1073  
    3030      if (initialized) is_MPI_Initialized=true ; 
    3131      else is_MPI_Initialized=false ; 
     32 
     33 
    3234       
    3335// don't use OASIS 
     
    3537      { 
    3638// localComm doesn't given 
     39 
     40        printf("check : localComm == MPI_COMM_NULL = %d\n", localComm == MPI_COMM_NULL); 
     41 
    3742        if (localComm == MPI_COMM_NULL) 
    3843        { 
     
    4146            //MPI_Init(NULL, NULL); 
    4247            int return_level; 
     48            #ifdef _intelmpi 
    4349            MPI_Init_thread(NULL, NULL, 3, &return_level); 
    4450            assert(return_level == 3); 
     51            #elif _openmpi 
     52            MPI_Init_thread(NULL, NULL, 2, &return_level); 
     53            assert(return_level == 2); 
     54            #endif 
    4555          } 
    4656          CTimer::get("XIOS").resume() ; 
     
    4959 
    5060          unsigned long hashClient=hashString(codeId) ; 
    51           unsigned long hashServer; //=hashString(CXios::xiosCodeId) ; 
    52           hashServer=hashString("xios.x") ; 
     61          unsigned long hashServer=hashString(CXios::xiosCodeId) ; 
     62          //hashServer=hashString("xios.x") ; 
    5363          unsigned long* hashAll ; 
    5464          int size ; 
     
    5666          int i,c ; 
    5767 
    58           MPI_Comm_size(CXios::globalComm,&size) ; 
     68          MPI_Comm_size(CXios::globalComm,&size); 
    5969          MPI_Comm_rank(CXios::globalComm,&rank); 
     70 
     71          printf("client init : codeId = %s, xiosCodeId = %s, rank = %d(%d), size = %d\n", codeId, CXios::xiosCodeId, rank, omp_get_thread_num(), size); 
     72           
    6073 
    6174          hashAll=new unsigned long[size] ; 
     
    198211 
    199212        MPI_Intercomm_create(contextComm,0,CXios::globalComm,serverLeader,10+globalRank,&contextInterComm) ; 
    200         info(10)<<"Register new Context : "<<id<<endl ; 
     213        //info(10)<<"Register new Context : "<<id<<endl ; 
    201214                       
    202215 
  • XIOS/dev/branch_yushan/src/client.hpp

    r1072 r1073  
    44#include "xios_spl.hpp" 
    55#include "mpi.hpp" 
    6 #ifdef _usingEP 
    7 //#include "ep_declaration.hpp" 
    8 #endif 
    96 
    107 
  • XIOS/dev/branch_yushan/src/cxios.cpp

    r1072 r1073  
    2222  bool CXios::isServer ; 
    2323  MPI_Comm CXios::globalComm ; 
    24   // #pragma omp threadprivate(CXios::globalComm) 
    25  
    2624  bool CXios::usingOasis ; 
    2725  bool CXios::usingServer = false; 
     
    3735  {     
    3836    set_new_handler(noMemory); 
    39     //#pragma omp critical(_output) 
    4037    #pragma omp master 
    4138    { 
     
    9794 
    9895    int tmp_rank; 
    99     MPI_Comm_rank(MPI_COMM_WORLD, &tmp_rank); 
    100     if(isClient) printf("client thread %d/%d, globalComm = %p\n", omp_get_thread_num(), tmp_rank, &passage[omp_get_thread_num()]); 
    101     if(isServer) printf("server thread %d/%d, globalComm = %p\n", omp_get_thread_num(), tmp_rank, &passage[omp_get_thread_num()]); 
     96    MPI_Comm_rank(globalComm, &tmp_rank); 
     97    if(isClient) printf("client thread %d/%d\n", omp_get_thread_num(), tmp_rank); 
     98    if(isServer) printf("server thread %d/%d\n", omp_get_thread_num(), tmp_rank); 
    10299     
    103100  } 
     
    115112    initialize() ; 
    116113 
    117     
     114 
     115 
    118116    CClient::initialize(codeId,localComm,returnComm) ; 
     117 
     118 
    119119    if (CClient::getRank()==0) globalRegistry = new CRegistry(returnComm) ; 
    120120 
     
    123123    isServer = !usingServer; 
    124124     
     125    printf("CXios::initClientSide OK, printLogs2Files = %d\n", printLogs2Files); 
    125126     
    126127    if (printLogs2Files) 
  • XIOS/dev/branch_yushan/src/cxios.hpp

    r1072 r1073  
    4444 
    4545     static bool isClient ; //!< Check if xios is client 
    46      //#pragma omp threadprivate(isClient) 
     46     #pragma omp threadprivate(isClient) 
    4747 
    4848     static bool isServer ; //!< Check if xios is server 
    49      //#pragma omp threadprivate(isServer) 
     49     #pragma omp threadprivate(isServer) 
    5050 
    5151     static MPI_Comm globalComm ; //!< Global communicator 
     
    5656 
    5757     static bool usingOasis ; //!< Using Oasis 
    58      //#pragma omp threadprivate(usingOasis) 
     58     #pragma omp threadprivate(usingOasis) 
    5959 
    6060     static bool usingServer ; //!< Using server (server mode) 
    61      //#pragma omp threadprivate(usingServer) 
     61     #pragma omp threadprivate(usingServer) 
    6262 
    6363     static double bufferSizeFactor; //!< Factor used to tune the buffer size 
    64      //#pragma omp threadprivate(bufferSizeFactor) 
     64     #pragma omp threadprivate(bufferSizeFactor) 
    6565 
    6666     static const double defaultBufferSizeFactor; //!< Default factor value 
    67      //#pragma omp threadprivate(defaultBufferSizeFactor) 
     67     #pragma omp threadprivate(defaultBufferSizeFactor) 
    6868 
    6969     static StdSize minBufferSize; //!< Minimum buffer size 
    70      //#pragma omp threadprivate(minBufferSize) 
     70     #pragma omp threadprivate(minBufferSize) 
    7171 
    7272     static bool isOptPerformance; //!< Check if buffer size is for performance (as large as possible) 
    73      //#pragma omp threadprivate(isOptPerformance) 
     73     #pragma omp threadprivate(isOptPerformance) 
    7474 
    7575     static CRegistry* globalRegistry ; //!< global registry which is wrote by the root process of the servers 
    76      //#pragma omp threadprivate(globalRegistry) 
     76     #pragma omp threadprivate(globalRegistry) 
    7777 
    7878    public: 
  • XIOS/dev/branch_yushan/src/test/test_client.f90

    r1072 r1073  
    33  USE xios 
    44  USE mod_wait 
    5   use omp_lib 
    65  IMPLICIT NONE 
    76  INCLUDE "mpif.h" 
     
    4039  CALL MPI_COMM_RANK(MPI_COMM_WORLD,rank,ierr) 
    4140  if(rank < 2) then 
     41 
    4242   
    4343  CALL xios_initialize(id,return_comm=comm) 
     
    4545  CALL MPI_COMM_RANK(comm,rank,ierr) 
    4646  CALL MPI_COMM_SIZE(comm,size,ierr) 
     47 
    4748 
    4849  DO j=1,nj_glo 
  • XIOS/dev/branch_yushan/src/xml_node.hpp

    r1072 r1073  
    4949 
    5050            static StdString RootName; 
    51             //#pragma omp threadprivate(RootName) 
     51            #pragma omp threadprivate(RootName) 
    5252 
    5353      }; //class CXMLParser 
  • XIOS/dev/branch_yushan/src/xml_parser.cpp

    r1072 r1073  
    1515      void CXMLParser::ParseFile(const StdString & filename, const std::set<StdString>& parseContextList) 
    1616      { 
    17          //printf("thread %d, parsefile = %s\n", omp_get_thread_num(), filename.c_str()); 
    1817         StdIFStream ifs ( filename.c_str() , StdIFStream::in ); 
    1918         if ( (ifs.rdstate() & std::ifstream::failbit ) != 0 ) 
  • XIOS/dev/branch_yushan/src/xml_parser.hpp

    r591 r1073  
    2020            static void ParseString(const StdString & xmlContent); 
    2121            static void ParseStream(StdIStream & stream, const string& fluxId, const std::set<StdString>& parseList); 
     22             
    2223            template <class T> 
    2324               static void ParseInclude(StdIStream & stream, const string& fluxId, T & object); 
Note: See TracChangeset for help on using the changeset viewer.