@@ -371,6 +371,14 @@ def get_allocation(
371371 whole_nodes = True
372372 whole_socks = True
373373
374+ if (
375+ str (self .CM .get_platform_parameter ('MPIRUN_VERSION' , silent = True )).upper ()
376+ == 'OPENMPI-DVM'
377+ ):
378+ return self ._get_dvm_allocation (
379+ comp_id , nproc , task_id , whole_nodes , whole_socks , ppn , task_cpp , task_gpp
380+ )
381+
374382 # Are there enough cores to satisfy the request?
375383 # Returns the list of nodes that fit the bill
376384 allocation_possible = False
@@ -525,6 +533,97 @@ def get_allocation(
525533 cores_allocated = cores_allocated ,
526534 )
527535
536+ def _get_dvm_allocation (
537+ self ,
538+ comp_id : str ,
539+ nproc : int ,
540+ task_id : int ,
541+ whole_nodes : bool ,
542+ whole_socks : bool ,
543+ ppn : int ,
544+ task_cpp : int ,
545+ task_gpp : int ,
546+ ) -> Allocation :
547+ """Reserve complete ranks for a DVM launch without reducing their core count.
548+
549+ :param comp_id: Identifier of the requesting component.
550+ :param nproc: Number of MPI ranks requested.
551+ :param task_id: Identifier used to track and release the allocation.
552+ :param whole_nodes: Whether to reserve entire nodes.
553+ :param whole_socks: Whether to reserve entire sockets.
554+ :param ppn: Maximum ranks per node requested by the caller.
555+ :param task_cpp: Physical cores per rank; zero retains launcher defaults.
556+ :param task_gpp: GPUs per rank.
557+ :returns: Allocation containing rank counts and reserved physical cores.
558+ :raises ValueError: If the rank or core count is invalid.
559+ :raises BadResourceRequestError: If the request exceeds total capacity.
560+ :raises InsufficientResourcesError: If capacity is temporarily occupied.
561+ """
562+ if nproc < 1 or not isinstance (task_cpp , int ) or task_cpp < 0 :
563+ raise ValueError ('DVM tasks require positive nproc and nonnegative integer task_cpp' )
564+ cpp = task_cpp or 1
565+ ppn = min (ppn , self .cores_per_node // cpp )
566+ total_capacity = sum (min (ppn , node .total_cores // cpp ) for node in self .nodes .values ())
567+ requested_nodes = ceil (nproc / max (ppn , 1 ))
568+ if nproc > total_capacity :
569+ raise BadResourceRequestError (
570+ comp_id , task_id , requested_nodes , max (1 , requested_nodes - len (self .nodes ))
571+ )
572+ if not self .check_gpus (ppn , task_gpp ):
573+ raise GpuResourceRequestMismatchError (comp_id , task_id , ppn , task_gpp , self .gpn )
574+
575+ # Plan first so a failed request never consumes a partial allocation.
576+ plan = []
577+ remaining = nproc
578+ for name in self .avail_nodes :
579+ node = self .nodes [name ]
580+ available = node .avail_cores
581+ if whole_nodes :
582+ available = available if available == node .total_cores else 0
583+ elif whole_socks :
584+ available = sum (
585+ sock .avail_cores
586+ for sock in node .sockets
587+ if sock .avail_cores == sock .total_cores
588+ )
589+ ranks = min (ppn , available // cpp , remaining )
590+ if ranks :
591+ plan .append ((name , ranks ))
592+ remaining -= ranks
593+ if not remaining :
594+ break
595+ if remaining :
596+ raise InsufficientResourcesError (
597+ comp_id , task_id , requested_nodes , ceil (remaining / ppn )
598+ )
599+
600+ entries = []
601+ cores_allocated = 0
602+ for name , ranks in plan :
603+ node = self .nodes [name ]
604+ count , cores = node .allocate (whole_nodes , whole_socks , task_id , comp_id , ranks * cpp )
605+ entries .append ((name , cores ))
606+ cores_allocated += count
607+ if name not in self .alloc_nodes :
608+ self .alloc_nodes .append (name )
609+ if not node .avail_cores :
610+ self .avail_nodes .remove (name )
611+ self .processes += nproc
612+ self .alloc_cores += cores_allocated
613+ self .avail_cores -= cores_allocated
614+ self .active_tasks [task_id ] = (comp_id , nproc , cores_allocated )
615+ self .report_rm_status ('allocation for DVM task %d' % task_id )
616+ return Allocation (
617+ partial_node = not whole_nodes ,
618+ nodelist = [name for name , _ in plan ],
619+ corelist = None if whole_nodes else entries ,
620+ ppn = ppn ,
621+ max_ppn = self .max_ppn ,
622+ cpp = task_cpp ,
623+ accurate_nodes = self .accurate_nodes ,
624+ cores_allocated = cores_allocated ,
625+ )
626+
528627 def check_whole_node_cap (self , nproc , ppn ):
529628 """
530629 Determine if it is currently possible to allocate *nproc* processes
0 commit comments