Changeset 1146


Ignore:
Timestamp:
05/24/17 16:59:40 (7 years ago)
Author:
yushan
Message:

save modif

Location:
XIOS/dev/branch_yushan_merged
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/branch_yushan_merged/extern/remap/src/clipper.cpp

    r919 r1146  
    10471047 
    10481048  //create a new edge array ... 
    1049   TEdge *edges = new TEdge [highI +1]; 
     1049  TEdge *edges = new TEdge[highI+1]; 
    10501050 
    10511051  bool IsFlat = true; 
     
    42744274{ 
    42754275  //The equation of a line in general form (Ax + By + C = 0) 
    4276   //given 2 points (x¹,y¹) & (x²,y²) is ... 
    4277   //(y¹ - y²)x + (x² - x¹)y + (y² - y¹)x¹ - (x² - x¹)y¹ = 0 
    4278   //A = (y¹ - y²); B = (x² - x¹); C = (y² - y¹)x¹ - (x² - x¹)y¹ 
    4279   //perpendicular distance of point (x³,y³) = (Ax³ + By³ + C)/Sqrt(A² + B²) 
     4276  //given 2 points (x,y) & (x,y) is ... 
     4277  //(y - y)x + (x - x)y + (y - y)x - (x - x)y = 0 
     4278  //A = (y - y); B = (x - x); C = (y - y)x - (x - x)y 
     4279  //perpendicular distance of point (x,y) = (Ax + By + C)/Sqrt(A + B) 
    42804280  //see http://en.wikipedia.org/wiki/Perpendicular_distance 
    42814281  double A = double(ln1.Y - ln2.Y); 
  • XIOS/dev/branch_yushan_merged/extern/remap/src/mapper.cpp

    r1141 r1146  
    548548    } 
    549549 
     550    MPI_Waitall(nbSendRequest, sendRequest, status); 
    550551    MPI_Waitall(nbRecvRequest, recvRequest, status); 
    551     MPI_Waitall(nbSendRequest, sendRequest, status); 
    552552 
    553553    for (int rank = 0; rank < mpiSize; rank++) 
     
    620620    } 
    621621 
     622    MPI_Waitall(nbSendRequest, sendRequest, status); 
    622623    MPI_Waitall(nbRecvRequest, recvRequest, status); 
    623     MPI_Waitall(nbSendRequest, sendRequest, status); 
    624  
     624  
    625625    int nbNeighbourNodes = 0; 
    626626    for (int rank = 0; rank < mpiSize; rank++) 
     
    803803        } 
    804804    } 
    805  
     805  
     806    MPI_Waitall(nbSendRequest, sendRequest, status); 
    806807    MPI_Waitall(nbRecvRequest, recvRequest, status); 
    807     MPI_Waitall(nbSendRequest, sendRequest, status); 
     808     
    808809    char **sendBuffer2 = new char*[mpiSize]; 
    809810    char **recvBuffer2 = new char*[mpiSize]; 
     
    886887        } 
    887888    } 
    888  
     889     
     890    MPI_Waitall(nbSendRequest, sendRequest, status); 
    889891    MPI_Waitall(nbRecvRequest, recvRequest, status); 
    890     MPI_Waitall(nbSendRequest, sendRequest, status); 
     892    
    891893 
    892894    delete [] sendRequest; 
  • XIOS/dev/branch_yushan_merged/extern/remap/src/timerRemap.cpp

    r694 r1146  
    99using namespace std; 
    1010 
    11 map<string,CTimer*> CTimer::allTimer; 
     11map<string,CTimer*> *CTimer::allTimer = 0; 
    1212 
    1313CTimer::CTimer(const string& name_) : name(name_) 
     
    5555CTimer& CTimer::get(const string name) 
    5656{ 
     57        if(allTimer == 0) allTimer = new map<string,CTimer*>; 
    5758        map<string,CTimer*>::iterator it; 
    58         it=allTimer.find(name); 
    59         if (it==allTimer.end()) it=allTimer.insert(pair<string,CTimer*>(name,new CTimer(name))).first; 
     59        it=(*allTimer).find(name); 
     60        if (it==(*allTimer).end()) it=(*allTimer).insert(pair<string,CTimer*>(name,new CTimer(name))).first; 
    6061        return *(it->second); 
    6162} 
  • XIOS/dev/branch_yushan_merged/extern/remap/src/timerRemap.hpp

    r694 r1146  
    2626    double getCumulatedTime(void); 
    2727    void print(void); 
    28     static map<string,CTimer*> allTimer; 
     28    //static map<string,CTimer*> allTimer; 
     29    static map<string,CTimer*> *allTimer; 
     30    #pragma omp threadprivate(allTimer) 
     31     
    2932    static double getTime(void); 
    3033    static CTimer& get(string name); 
  • XIOS/dev/branch_yushan_merged/extern/src_ep_dev/ep_alltoall.cpp

    r1134 r1146  
    1010  int MPI_Alltoall(const void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, MPI_Comm comm) 
    1111  { 
     12    assert(static_cast< ::MPI_Datatype>(sendtype) == static_cast< ::MPI_Datatype>(recvtype)); 
    1213    ::MPI_Aint typesize, llb; 
    1314    ::MPI_Type_get_extent(static_cast< ::MPI_Datatype>(sendtype), &llb, &typesize); 
     15     
     16    int ep_size; 
     17    MPI_Comm_size(comm, &ep_size); 
    1418 
    15     for(int i=0; i<comm.ep_comm_ptr->size_rank_info[0].second; i++) 
     19    for(int i=0; i<ep_size; i++) 
    1620    { 
    17       MPI_Gather((char*)sendbuf+i*sendcount*typesize, sendcount, sendtype, recvbuf, recvcount, recvtype, i, comm); 
     21      MPI_Gather(sendbuf+i*sendcount*typesize, sendcount, sendtype, recvbuf, recvcount, recvtype, i, comm); 
    1822    } 
    1923 
  • XIOS/dev/branch_yushan_merged/extern/src_ep_dev/ep_wait.cpp

    r1138 r1146  
    8686 
    8787        int finished = 0; 
    88         bool finished_index[count]; 
     88        int finished_index[count]; 
    8989 
    9090        for(int i=0; i<count; i++) 
     
    9797            for(int i=0; i<count; i++) 
    9898            { 
     99                //MPI_Test(&array_of_requests[i], &finished_index[i], &array_of_statuses[i]); 
    99100                if(finished_index[i] == false) // this request has not been tested. 
    100101                { 
     
    102103                    {       
    103104                        MPI_Wait(&array_of_requests[i], &array_of_statuses[i]); 
    104                         if(array_of_requests[i].type == 3) 
    105                         { 
    106                             //int check_count; 
    107                             //MPI_Get_count(&array_of_statuses[i], array_of_requests[i].ep_datatype, &check_count); 
    108                             //check_sum_recv(array_of_requests[i].buf, count, array_of_requests[i].ep_datatype, array_of_requests[i].ep_src, array_of_requests[i].ep_tag, array_of_requests[i].comm, 2); 
    109                         } 
    110105                        finished++; 
    111106                        finished_index[i] = true; 
  • XIOS/dev/branch_yushan_merged/src/io/netCdfInterface.cpp

    r1138 r1146  
    103103int CNetCdfInterface::openPar(const StdString& fileName, int oMode, MPI_Comm comm, MPI_Info info, int& ncId) 
    104104{ 
    105   int status = xios::nc_open_par(fileName.c_str(), oMode, comm, info, &ncId); 
     105  int status; 
     106  #pragma omp critical (_netcdf) 
     107  status = xios::nc_open_par(fileName.c_str(), oMode, comm, info, &ncId); 
    106108  if (NC_NOERR != status) 
    107109  { 
     
    347349int CNetCdfInterface::inqDimLen(int ncid, int dimId, StdSize& dimLen) 
    348350{ 
    349   int status = nc_inq_dimlen(ncid, dimId, &dimLen); 
     351  int status; 
     352  #pragma omp critical (_netcdf) 
     353  status = nc_inq_dimlen(ncid, dimId, &dimLen); 
    350354  if (NC_NOERR != status) 
    351355  { 
  • XIOS/dev/branch_yushan_merged/src/io/netCdfInterface_impl.hpp

    r1138 r1146  
    8686  int CNetCdfInterface::getVaraType(int ncid, int varId, const StdSize* start, const StdSize* count, T* data) 
    8787  { 
    88     int status = ncGetVaraType(ncid, varId, start, count, data); 
     88    int status; 
     89    #pragma omp critical (_netcdf) 
     90    status = ncGetVaraType(ncid, varId, start, count, data); 
    8991    if (NC_NOERR != status) 
    9092    { 
  • XIOS/dev/branch_yushan_merged/src/node/context.cpp

    r1134 r1146  
    2121  shared_ptr<CContextGroup> * CContext::root_ptr = 0; 
    2222 
    23    /// ////////////////////// Définitions ////////////////////// /// 
     23   /// ////////////////////// Dfinitions ////////////////////// /// 
    2424 
    2525   CContext::CContext(void) 
     
    184184      if (!this->hasChild()) 
    185185      { 
    186          //oss << "<!-- No definition -->" << std::endl; // fait planter l'incrémentation 
     186         //oss << "<!-- No definition -->" << std::endl; // fait planter l'incrmentation 
    187187      } 
    188188      else 
     
    554554   void CContext::solveAllInheritance(bool apply) 
    555555   { 
    556      // Résolution des héritages descendants (càd des héritages de groupes) 
     556     // Rsolution des hritages descendants (cd des hritages de groupes) 
    557557     // pour chacun des contextes. 
    558558      solveDescInheritance(apply); 
    559559 
    560      // Résolution des héritages par référence au niveau des fichiers. 
     560     // Rsolution des hritages par rfrence au niveau des fichiers. 
    561561      const vector<CFile*> allFiles=CFile::getAll(); 
    562562      const vector<CGrid*> allGrids= CGrid::getAll(); 
     
    582582 
    583583      for (unsigned int i = 0; i < allFiles.size(); i++) 
    584          if (!allFiles[i]->enabled.isEmpty()) // Si l'attribut 'enabled' est défini. 
     584         if (!allFiles[i]->enabled.isEmpty()) // Si l'attribut 'enabled' est dfini. 
    585585         { 
    586             if (allFiles[i]->enabled.getValue()) // Si l'attribut 'enabled' est fixé à vrai. 
     586            if (allFiles[i]->enabled.getValue()) // Si l'attribut 'enabled' est fix  vrai. 
    587587            { 
    588588              if ((initDate + allFiles[i]->output_freq.getValue()) < (initDate + this->getCalendar()->getTimeStep())) 
     
    609609 
    610610      if (enabledFiles.size() == 0) 
    611          DEBUG(<<"Aucun fichier ne va être sorti dans le contexte nommé \"" 
     611         DEBUG(<<"Aucun fichier ne va tre sorti dans le contexte nomm \"" 
    612612               << getId() << "\" !"); 
    613613   } 
     
    849849      prepareTimeseries(); 
    850850 
    851       //Initialisation du vecteur 'enabledFiles' contenant la liste des fichiers à sortir. 
     851      //Initialisation du vecteur 'enabledFiles' contenant la liste des fichiers sortir. 
    852852      this->findEnabledFiles(); 
    853853      this->findEnabledReadModeFiles(); 
  • XIOS/dev/branch_yushan_merged/src/node/file.cpp

    r1138 r1146  
    612612     if (time_counter_name.isEmpty()) time_counter_name = "time_counter"; 
    613613 
     614     //#pragma omp critical (_checkFile) 
    614615     checkFile(); 
    615616 
  • XIOS/dev/branch_yushan_merged/src/server.cpp

    r1141 r1146  
    340340            MPI_Isend(buff,count,MPI_CHAR,i,2,intraComm,&requests[i-1]) ; 
    341341         } 
     342          
    342343         MPI_Waitall(size-1,requests,status) ; 
    343344         registerContext(buff,count,it->second.leaderRank) ; 
  • XIOS/dev/branch_yushan_merged/src/test/test_remap_omp.f90

    r1141 r1146  
    5252  if(rank < size-2) then 
    5353 
    54   !$omp parallel default(private) 
     54  !$omp parallel default(firstprivate)  
    5555 
    5656!!! XIOS Initialization (get the local communicator) 
     
    6060  CALL MPI_COMM_SIZE(comm,size,ierr) 
    6161 
     62   
     63  !$omp critical (open_file) 
    6264  ierr=NF90_OPEN(src_file, NF90_NOWRITE, ncid) 
     65  !$omp end critical (open_file) 
     66 
    6367  ierr=NF90_INQ_VARID(ncid,"bounds_lon",varid) 
    6468  ierr=NF90_INQUIRE_VARIABLE(ncid, varid,dimids=dimids) 
     
    134138  ENDDO 
    135139 
     140  !$omp critical (open_file) 
    136141  ierr=NF90_OPEN(dst_file, NF90_NOWRITE, ncid) 
     142  !$omp end critical (open_file) 
     143 
     144   
    137145  ierr=NF90_INQ_VARID(ncid,"bounds_lon",varid) 
    138146  ierr=NF90_INQUIRE_VARIABLE(ncid, varid,dimids=dimids) 
     
    168176  CALL xios_get_handle("test",ctx_hdl) 
    169177  CALL xios_set_current_context(ctx_hdl) 
    170  
     178   
    171179  CALL xios_set_domain_attr("src_domain", ni_glo=src_ni_glo, ibegin=src_ibegin, ni=src_ni, type="unstructured") 
    172180  CALL xios_set_domain_attr("src_domain", lonvalue_1D=src_lon, latvalue_1D=src_lat, & 
     
    189197                            bounds_lon_1D=src_boundslon, bounds_lat_1D=src_boundslat, nvertex=src_nvertex) 
    190198 
    191  
    192199  dtime%second = 3600 
    193200   
     
    195202 
    196203  CALL xios_close_context_definition() 
    197   CALL xios_get_domain_attr("src_domain_regular_read", ni=src_tmp_ni, nj=src_tmp_nj) 
    198   ALLOCATE(tmp_field_0(src_tmp_ni*src_tmp_nj)) 
    199  
    200   CALL xios_get_axis_attr("src_axis_curvilinear_read", n=src_tmp_n) 
    201   CALL xios_get_domain_attr("src_domain_curvilinear_read", ni=src_tmp_ni, nj=src_tmp_nj) 
    202   ALLOCATE(tmp_field_1(src_tmp_ni*src_tmp_nj*src_tmp_n)) 
    203  
    204   CALL xios_get_domain_attr("src_domain_unstructured_read", ni=src_tmp_ni, nj=src_tmp_nj) 
    205   ALLOCATE(tmp_field_2(src_tmp_ni*src_tmp_nj)) 
    206    
    207   CALL xios_recv_field("src_field_regular", tmp_field_0) 
    208   CALL xios_recv_field("src_field_curvilinear", tmp_field_1) 
    209   CALL xios_recv_field("src_field_unstructured", tmp_field_2) 
    210  
    211   DO ts=1,10 
    212     CALL xios_update_calendar(ts) 
    213     CALL xios_send_field("src_field_2D",src_field_2D) 
    214      
    215     DO i=1,src_ni 
    216       src_field_2D_clone(i) = src_field_2D(i) 
    217       IF ((23.5 * ts < src_lat(i)) .AND. (src_lat(i) < 65.5 *ts) .AND. (0 < src_lon(i)) .AND. (src_lon(i) < 30*ts)) THEN       
    218         src_field_2D_clone(i) = missing_value     
    219       ENDIF 
    220     ENDDO 
    221  
    222     CALL xios_send_field("src_field_2D_clone",src_field_2D_clone) 
    223     CALL xios_send_field("src_field_3D",src_field_3D) 
    224     CALL xios_send_field("src_field_3D_clone",src_field_3D) 
    225     CALL xios_send_field("src_field_4D",src_field_4D) 
    226     CALL xios_send_field("src_field_3D_pression",src_field_pression) 
    227     CALL xios_send_field("tmp_field_0",tmp_field_0) 
    228     CALL xios_send_field("tmp_field_1",tmp_field_1) 
    229     CALL xios_send_field("tmp_field_2",tmp_field_2) 
    230     CALL wait_us(5000) ; 
    231    ENDDO 
    232  
     204   
    233205  CALL xios_context_finalize() 
    234  
    235   DEALLOCATE(src_lon, src_lat, src_boundslon,src_boundslat, src_field_2D) 
    236   DEALLOCATE(dst_lon, dst_lat, dst_boundslon,dst_boundslat) 
    237   DEALLOCATE(tmp_field_0, tmp_field_1, tmp_field_2) 
    238  
    239    
    240  
     206   
    241207  CALL xios_finalize() 
    242208   
Note: See TracChangeset for help on using the changeset viewer.