Difference for src/ComputeMgr.C from version 1.1132 to 1.1133

version 1.1132version 1.1133
Line 364
Line 364
   return ComputeCUDAMgr::getComputeCUDAMgr()->createCudaComputeNonbonded(c);   return ComputeCUDAMgr::getComputeCUDAMgr()->createCudaComputeNonbonded(c);
 } }
  
  #ifdef BONDED_CUDA
  ComputeBondedCUDA* getComputeBondedCUDA() {
    return ComputeCUDAMgr::getComputeCUDAMgr()->getComputeBondedCUDA();
  }
  
  ComputeBondedCUDA* createComputeBondedCUDA(ComputeID c, ComputeMgr* computeMgr) {
    return ComputeCUDAMgr::getComputeCUDAMgr()->createComputeBondedCUDA(c, computeMgr);
  }
  #endif
 #endif #endif
  
 // //
Line 473
Line 482
       c->initialize();       c->initialize();
       break;       break;
 #endif #endif
  #ifdef NAMD_CUDA
  #ifdef BONDED_CUDA
      case computeBondedCUDAType:
        c = createComputeBondedCUDA(i, this);
        map->registerCompute(i,c);
        break;
  #endif
  #endif
     case computeExclsType:     case computeExclsType:
  #if defined(BONDED_CUDA) && defined(NAMD_CUDA)
          if (simParams->bondedCUDA & 16)
          {
            PatchMap::Object()->basePatchIDList(map->computeData[i].node, pids);
            getComputeBondedCUDA()->registerCompute(map->computeData[i].node, map->type(i), pids);
          } else
  #endif
          {
       PatchMap::Object()->basePatchIDList(CkMyPe(),pids);       PatchMap::Object()->basePatchIDList(CkMyPe(),pids);
       c = new ComputeExcls(i,pids); // unknown delete       c = new ComputeExcls(i,pids); // unknown delete
       map->registerCompute(i,c);       map->registerCompute(i,c);
       c->initialize();       c->initialize();
        }
       break;       break;
     case computeBondsType:     case computeBondsType:
  #if defined(BONDED_CUDA) && defined(NAMD_CUDA)
          if (simParams->bondedCUDA & 1)
          {
            PatchMap::Object()->basePatchIDList(map->computeData[i].node, pids);
            getComputeBondedCUDA()->registerCompute(map->computeData[i].node, map->type(i), pids);
          } else
  #endif
          {
         PatchMap::Object()->basePatchIDList(CkMyPe(),pids);         PatchMap::Object()->basePatchIDList(CkMyPe(),pids);
         c = new ComputeBonds(i,pids); // unknown delete         c = new ComputeBonds(i,pids); // unknown delete
         map->registerCompute(i,c);         map->registerCompute(i,c);
         c->initialize();         c->initialize();
          }
         break;         break;
     case computeAnglesType:     case computeAnglesType:
  #if defined(BONDED_CUDA) && defined(NAMD_CUDA)
          if (simParams->bondedCUDA & 2)
          {
            PatchMap::Object()->basePatchIDList(map->computeData[i].node, pids);
            getComputeBondedCUDA()->registerCompute(map->computeData[i].node, map->type(i), pids);
          } else
  #endif
          {
         PatchMap::Object()->basePatchIDList(CkMyPe(),pids);         PatchMap::Object()->basePatchIDList(CkMyPe(),pids);
         c = new ComputeAngles(i,pids); // unknown delete         c = new ComputeAngles(i,pids); // unknown delete
         map->registerCompute(i,c);         map->registerCompute(i,c);
         c->initialize();         c->initialize();
          }
         break;         break;
     case computeDihedralsType:     case computeDihedralsType:
  #if defined(BONDED_CUDA) && defined(NAMD_CUDA)
          if (simParams->bondedCUDA & 4)
          {
            PatchMap::Object()->basePatchIDList(map->computeData[i].node, pids);
            getComputeBondedCUDA()->registerCompute(map->computeData[i].node, map->type(i), pids);
          } else
  #endif
          {
         PatchMap::Object()->basePatchIDList(CkMyPe(),pids);         PatchMap::Object()->basePatchIDList(CkMyPe(),pids);
         c = new ComputeDihedrals(i,pids); // unknown delete         c = new ComputeDihedrals(i,pids); // unknown delete
         map->registerCompute(i,c);         map->registerCompute(i,c);
         c->initialize();         c->initialize();
          }
         break;         break;
     case computeImpropersType:     case computeImpropersType:
  #if defined(BONDED_CUDA) && defined(NAMD_CUDA)
          if (simParams->bondedCUDA & 8)
          {
            PatchMap::Object()->basePatchIDList(map->computeData[i].node, pids);
            getComputeBondedCUDA()->registerCompute(map->computeData[i].node, map->type(i), pids);
          } else
  #endif
          {
         PatchMap::Object()->basePatchIDList(CkMyPe(),pids);         PatchMap::Object()->basePatchIDList(CkMyPe(),pids);
         c = new ComputeImpropers(i,pids); // unknown delete         c = new ComputeImpropers(i,pids); // unknown delete
         map->registerCompute(i,c);         map->registerCompute(i,c);
         c->initialize();         c->initialize();
          }
         break;         break;
     case computeTholeType:     case computeTholeType:
         PatchMap::Object()->basePatchIDList(CkMyPe(),pids);         PatchMap::Object()->basePatchIDList(CkMyPe(),pids);
Line 516
Line 578
         c->initialize();         c->initialize();
         break;         break;
     case computeCrosstermsType:     case computeCrosstermsType:
  #if defined(BONDED_CUDA) && defined(NAMD_CUDA)
          if (simParams->bondedCUDA & 32)
          {
            PatchMap::Object()->basePatchIDList(map->computeData[i].node, pids);
            getComputeBondedCUDA()->registerCompute(map->computeData[i].node, map->type(i), pids);
          } else
  #endif
          {
         PatchMap::Object()->basePatchIDList(CkMyPe(),pids);         PatchMap::Object()->basePatchIDList(CkMyPe(),pids);
         c = new ComputeCrossterms(i,pids); // unknown delete         c = new ComputeCrossterms(i,pids); // unknown delete
         map->registerCompute(i,c);         map->registerCompute(i,c);
         c->initialize();         c->initialize();
          }
         break;         break;
  // JLai  // JLai
     case computeGromacsPairType:     case computeGromacsPairType:
Line 535
Line 606
        break;        break;
  // End of JLai  // End of JLai
     case computeSelfExclsType:     case computeSelfExclsType:
  #if defined(BONDED_CUDA) && defined(NAMD_CUDA)
          if (simParams->bondedCUDA & 16)
          {
            getComputeBondedCUDA()->registerSelfCompute(map->computeData[i].node, map->type(i), map->computeData[i].pids[0].pid);
          } else
  #endif
          {
         c = new ComputeSelfExcls(i,map->computeData[i].pids[0].pid);         c = new ComputeSelfExcls(i,map->computeData[i].pids[0].pid);
         map->registerCompute(i,c);         map->registerCompute(i,c);
         c->initialize();         c->initialize();
          }
         break;         break;
     case computeSelfBondsType:     case computeSelfBondsType:
  #if defined(BONDED_CUDA) && defined(NAMD_CUDA)
          if (simParams->bondedCUDA & 1)
          {
            getComputeBondedCUDA()->registerSelfCompute(map->computeData[i].node, map->type(i), map->computeData[i].pids[0].pid);
          } else
  #endif
          {
         c = new ComputeSelfBonds(i,map->computeData[i].pids[0].pid);         c = new ComputeSelfBonds(i,map->computeData[i].pids[0].pid);
         map->registerCompute(i,c);         map->registerCompute(i,c);
         c->initialize();         c->initialize();
          }
         break;         break;
     case computeSelfAnglesType:     case computeSelfAnglesType:
  #if defined(BONDED_CUDA) && defined(NAMD_CUDA)
          if (simParams->bondedCUDA & 2)
          {
            getComputeBondedCUDA()->registerSelfCompute(map->computeData[i].node, map->type(i), map->computeData[i].pids[0].pid);
          } else
  #endif
          {
         c = new ComputeSelfAngles(i,map->computeData[i].pids[0].pid);         c = new ComputeSelfAngles(i,map->computeData[i].pids[0].pid);
         map->registerCompute(i,c);         map->registerCompute(i,c);
         c->initialize();         c->initialize();
          }
         break;         break;
     case computeSelfDihedralsType:     case computeSelfDihedralsType:
  #if defined(BONDED_CUDA) && defined(NAMD_CUDA)
          if (simParams->bondedCUDA & 4)
          {
            getComputeBondedCUDA()->registerSelfCompute(map->computeData[i].node, map->type(i), map->computeData[i].pids[0].pid);
          } else
  #endif
          {
         c = new ComputeSelfDihedrals(i,map->computeData[i].pids[0].pid);         c = new ComputeSelfDihedrals(i,map->computeData[i].pids[0].pid);
         map->registerCompute(i,c);         map->registerCompute(i,c);
         c->initialize();         c->initialize();
          }
         break;         break;
     case computeSelfImpropersType:     case computeSelfImpropersType:
  #if defined(BONDED_CUDA) && defined(NAMD_CUDA)
          if (simParams->bondedCUDA & 8)
          {
            getComputeBondedCUDA()->registerSelfCompute(map->computeData[i].node, map->type(i), map->computeData[i].pids[0].pid);
          } else
  #endif
          {
         c = new ComputeSelfImpropers(i,map->computeData[i].pids[0].pid);         c = new ComputeSelfImpropers(i,map->computeData[i].pids[0].pid);
         map->registerCompute(i,c);         map->registerCompute(i,c);
         c->initialize();         c->initialize();
          }
         break;         break;
     case computeSelfTholeType:     case computeSelfTholeType:
         c = new ComputeSelfThole(i,map->computeData[i].pids[0].pid);         c = new ComputeSelfThole(i,map->computeData[i].pids[0].pid);
Line 570
Line 681
         c->initialize();         c->initialize();
         break;         break;
     case computeSelfCrosstermsType:     case computeSelfCrosstermsType:
  #if defined(BONDED_CUDA) && defined(NAMD_CUDA)
          if (simParams->bondedCUDA & 32)
          {
            getComputeBondedCUDA()->registerSelfCompute(map->computeData[i].node, map->type(i), map->computeData[i].pids[0].pid);
          } else
  #endif
          {
         c = new ComputeSelfCrossterms(i,map->computeData[i].pids[0].pid);         c = new ComputeSelfCrossterms(i,map->computeData[i].pids[0].pid);
         map->registerCompute(i,c);         map->registerCompute(i,c);
         c->initialize();         c->initialize();
          }
         break;         break;
 #ifdef DPMTA #ifdef DPMTA
     case computeDPMTAType:     case computeDPMTAType:
Line 753
Line 872
             dz = abs(z1-z2);             dz = abs(z1-z2);
             sprintf(user_des, "computeNonBondedPairType_%d(%d,%d,%d)", i, dx,dy,dz);             sprintf(user_des, "computeNonBondedPairType_%d(%d,%d,%d)", i, dx,dy,dz);
             break;             break;
  #ifdef NAMD_CUDA
  #ifdef BONDED_CUDA
          case computeBondedCUDAType:
              sprintf(user_des, "computeBondedCUDAType_%d", i);
              break;
  #endif
  #endif
         case computeExclsType:         case computeExclsType:
             sprintf(user_des, "computeExclsType_%d", i);             sprintf(user_des, "computeExclsType_%d", i);
             break;             break;
Line 938
Line 1064
  
 #ifdef NAMD_CUDA #ifdef NAMD_CUDA
     bool deviceIsMine = ( deviceCUDA->getMasterPe() == CkMyPe() );     bool deviceIsMine = ( deviceCUDA->getMasterPe() == CkMyPe() );
  #ifdef BONDED_CUDA
      // Place bonded forces on Pe different from non-bonded forces
      int bondedMasterPe = deviceCUDA->getMasterPe();
      // for (int i=0;i < deviceCUDA->getNumPesSharingDevice();i++) {
      //   int pe = deviceCUDA->getPesSharingDevice(i);
      //   if (pe != deviceCUDA->getMasterPe()) {
      //     bondedMasterPe = pe;
      //   }
      // }
      bool deviceIsMineBonded = (CkMyPe() == bondedMasterPe);
  #endif
 #endif #endif
  
     #ifdef NAMD_MIC     #ifdef NAMD_MIC
Line 949
Line 1086
         if ( ! ( i % 100 ) )         if ( ! ( i % 100 ) )
         {         {
         }         }
  
 #if defined(NAMD_CUDA) || defined(NAMD_MIC) #if defined(NAMD_CUDA) || defined(NAMD_MIC)
         switch ( map->type(i) )         switch ( map->type(i) )
         {         {
Line 960
Line 1098
           //  ComputePmeCUDACounter++;           //  ComputePmeCUDACounter++;
           //  break;           //  break;
           case computeNonbondedSelfType:           case computeNonbondedSelfType:
              if ( ! deviceIsMine ) continue;
              if ( ! deviceCUDA->device_shared_with_pe(map->computeData[i].node) ) continue;
            break;
  
           case computeNonbondedPairType:           case computeNonbondedPairType:
             if ( ! deviceIsMine ) continue;             if ( ! deviceIsMine ) continue;
             if ( ! deviceCUDA->device_shared_with_pe(map->computeData[i].node) ) continue;             if ( ! deviceCUDA->device_shared_with_pe(map->computeData[i].node) ) continue;
           break;           break;
  
  #ifdef BONDED_CUDA
            case computeSelfBondsType:
            case computeBondsType:
              if (simParams->bondedCUDA & 1) {
                if ( ! deviceIsMineBonded ) continue;
                if ( ! deviceCUDA->device_shared_with_pe(map->computeData[i].node) ) continue;
              } else {
                if ( map->computeData[i].node != myNode ) continue;
              }
            break;
  
            case computeSelfAnglesType:
            case computeAnglesType:
              if (simParams->bondedCUDA & 2) {
                if ( ! deviceIsMineBonded ) continue;
                if ( ! deviceCUDA->device_shared_with_pe(map->computeData[i].node) ) continue;
              } else {
                if ( map->computeData[i].node != myNode ) continue;
              }
            break;
  
            case computeSelfDihedralsType:
            case computeDihedralsType:
              if (simParams->bondedCUDA & 4) {
                if ( ! deviceIsMineBonded ) continue;
                if ( ! deviceCUDA->device_shared_with_pe(map->computeData[i].node) ) continue;
              } else {
                if ( map->computeData[i].node != myNode ) continue;
              }
            break;
  
            case computeSelfImpropersType:
            case computeImpropersType:
              if (simParams->bondedCUDA & 8) {
                if ( ! deviceIsMineBonded ) continue;
                if ( ! deviceCUDA->device_shared_with_pe(map->computeData[i].node) ) continue;
              } else {
                if ( map->computeData[i].node != myNode ) continue;
              }
            break;
  
            case computeSelfExclsType:
            case computeExclsType:
              if (simParams->bondedCUDA & 16) {
                if ( ! deviceIsMineBonded ) continue;
                if ( ! deviceCUDA->device_shared_with_pe(map->computeData[i].node) ) continue;
              } else {
                if ( map->computeData[i].node != myNode ) continue;
              }
            break;
  
            case computeSelfCrosstermsType:
            case computeCrosstermsType:
              if (simParams->bondedCUDA & 32) {
                if ( ! deviceIsMineBonded ) continue;
                if ( ! deviceCUDA->device_shared_with_pe(map->computeData[i].node) ) continue;
              } else {
                if ( map->computeData[i].node != myNode ) continue;
              }
            break;
  
            case computeBondedCUDAType:
              if ( ! deviceIsMineBonded ) continue;
              if ( map->computeData[i].node != myNode ) continue;
            break;
  #endif
  
 #endif #endif
 #ifdef NAMD_MIC #ifdef NAMD_MIC
  
Line 989
Line 1199
           case computeNonbondedCUDAType:           case computeNonbondedCUDAType:
 #ifdef NAMD_CUDA #ifdef NAMD_CUDA
           case computeNonbondedCUDA2Type:           case computeNonbondedCUDA2Type:
  // #ifdef BONDED_CUDA
  //           case computeBondedCUDAType:
  // #endif
 #endif #endif
           case computeNonbondedMICType:           case computeNonbondedMICType:
             if ( ! deviceIsMine ) continue;             if ( ! deviceIsMine ) continue;
Line 1027
Line 1240
         computeNonbondedCUDAObject->assignPatches();         computeNonbondedCUDAObject->assignPatches();
       }             }      
     }     }
  #ifdef BONDED_CUDA
      if (simParams->bondedCUDA) {
        if (deviceIsMineBonded) {
          getComputeBondedCUDA()->initialize();
        }
      }
  #endif
 #endif #endif
 #ifdef NAMD_MIC #ifdef NAMD_MIC
     if ( computeNonbondedMICObject ) {     if ( computeNonbondedMICObject ) {
Line 1476
Line 1696
   msg->c->unregisterBoxesOnPe();   msg->c->unregisterBoxesOnPe();
   delete msg;   delete msg;
 } }
  
  #ifdef BONDED_CUDA
  
  class ComputeBondedCUDAMsg : public CMessage_ComputeBondedCUDAMsg {
  public:
    ComputeBondedCUDA* c;
    int i;
  };
  
  void ComputeMgr::sendAssignPatchesOnPe(std::vector<int>& pes, ComputeBondedCUDA* c) {
    for (int i=0;i < pes.size();i++) {
      ComputeBondedCUDAMsg *msg = new ComputeBondedCUDAMsg;
      msg->c = c;
      thisProxy[pes[i]].recvAssignPatchesOnPe(msg);
    }
  }
  
  void ComputeMgr::recvAssignPatchesOnPe(ComputeBondedCUDAMsg *msg) {
    msg->c->assignPatchesOnPe();
    delete msg;
  }
  
  void ComputeMgr::sendMessageEnqueueWork(int pe, ComputeBondedCUDA* c) {
    ComputeBondedCUDAMsg *msg = new ComputeBondedCUDAMsg;
    msg->c = c;
    thisProxy[pe].recvMessageEnqueueWork(msg);
  }
  
  void ComputeMgr::recvMessageEnqueueWork(ComputeBondedCUDAMsg *msg) {
    msg->c->messageEnqueueWork();
    delete msg;
  }
  
  void ComputeMgr::sendOpenBoxesOnPe(std::vector<int>& pes, ComputeBondedCUDA* c) {
    for (int i=0;i < pes.size();i++) {
      ComputeBondedCUDAMsg *msg = new ComputeBondedCUDAMsg;
      msg->c = c;
      thisProxy[pes[i]].recvOpenBoxesOnPe(msg);
    }
  }
  
  void ComputeMgr::recvOpenBoxesOnPe(ComputeBondedCUDAMsg *msg) {
    msg->c->openBoxesOnPe();
    delete msg;
  }
  
  void ComputeMgr::sendLoadTuplesOnPe(std::vector<int>& pes, ComputeBondedCUDA* c) {
    for (int i=0;i < pes.size();i++) {
      ComputeBondedCUDAMsg *msg = new ComputeBondedCUDAMsg;
      msg->c = c;
      thisProxy[pes[i]].recvLoadTuplesOnPe(msg);
    }
  }
  
  void ComputeMgr::recvLoadTuplesOnPe(ComputeBondedCUDAMsg *msg) {
    msg->c->loadTuplesOnPe();
    delete msg;
  }
  
  void ComputeMgr::sendLaunchWork(int pe, ComputeBondedCUDA* c) {
    ComputeBondedCUDAMsg *msg = new ComputeBondedCUDAMsg;
    msg->c = c;
    thisProxy[pe].recvLaunchWork(msg);
  }
  
  void ComputeMgr::recvLaunchWork(ComputeBondedCUDAMsg *msg) {
    msg->c->launchWork();
    delete msg;
  }
  
  void ComputeMgr::sendFinishPatchesOnPe(std::vector<int>& pes, ComputeBondedCUDA* c) {
    for (int i=0;i < pes.size();i++) {
      ComputeBondedCUDAMsg *msg = new ComputeBondedCUDAMsg;
      msg->c = c;
      thisProxy[pes[i]].recvFinishPatchesOnPe(msg);
    }
  }
  
  void ComputeMgr::recvFinishPatchesOnPe(ComputeBondedCUDAMsg *msg) {
    msg->c->finishPatchesOnPe();
    delete msg;
  }
  
  void ComputeMgr::sendFinishReductions(int pe, ComputeBondedCUDA* c) {
    ComputeBondedCUDAMsg *msg = new ComputeBondedCUDAMsg;
    msg->c = c;
    thisProxy[pe].recvFinishReductions(msg);
  }
  
  void ComputeMgr::recvFinishReductions(ComputeBondedCUDAMsg *msg) {
    msg->c->finishReductions();
    delete msg;
  }
  
  void ComputeMgr::sendUnregisterBoxesOnPe(std::vector<int>& pes, ComputeBondedCUDA* c) {
    for (int i=0;i < pes.size();i++) {
      ComputeBondedCUDAMsg *msg = new ComputeBondedCUDAMsg;
      msg->c = c;
      thisProxy[pes[i]].recvUnregisterBoxesOnPe(msg);
    }
  }
  
  void ComputeMgr::recvUnregisterBoxesOnPe(ComputeBondedCUDAMsg *msg) {
    msg->c->unregisterBoxesOnPe();
    delete msg;
  }
  
  #endif // BONDED_CUDA
  
 #endif // NAMD_CUDA #endif // NAMD_CUDA
  
 void ComputeMgr::sendCreateNonbondedMICSlave(int pe, int index) { void ComputeMgr::sendCreateNonbondedMICSlave(int pe, int index) {


Legend:
Removed in v.1.1132 
changed lines
 Added in v.1.1133



Made by using version 1.53 of cvs2html