def get_pin_domain_affinity(
        self, cpu_pools, ccl_worker_count, logical_cores_for_ccl=False
    ):
        """
        I_MPI_PIN_DOMAIN specify the cores used for every MPI process.
        1) use physical core for oneccl
           The first ccl_worker_count cores of every rank for ccl communication
           and the other cores will be used to do computation.
           For example: on CascadeLake 8280 CPU, 2 ranks on one node. ccl_worker_count=4
           CCL_WORKER_COUNT=4
           CCL_WORKER_AFFINITY="0,1,2,3,28,29,30,31"
           I_MPI_PIN_DOMAIN=[0xffffff0,0xffffff00000000]
        2) use logical core oneccl
           The first ccl_worker_count logical cores which is correponding to the
           first ccl_worker_count physical cores are used as the ccl cores.
           For example: on CascadeLake 8280 CPU, 2 ranks on one node. ccl_worker_count=4
           CCL_WORKER_COUNT=4
           CCL_WORKER_AFFINITY="56,57,58,59,84,85,86,87"
           I_MPI_PIN_DOMAIN=[0xfffffff,0xfffffff0000000]
        """
        domain_binaries = []
        affinity = []
        for pool in cpu_pools:
            if (
                logical_cores_for_ccl
                and len([c for c in pool if not c.is_physical_core]) < ccl_worker_count
            ):
                self.verbose(
                    "warning",
                    "Argument --logical-cores-for-ccl is set but no enough logical cores are available. Disable this argument."
                    + "please see https://intel.github.io/intel-extension-for-pytorch/cpu/latest/tutorials/performance_tuning/launch_script.html#launch-script-usage-guide"  # noqa: B950
                    + "for usage guide",
                    warning_type=WarningType.WrongArgument,
                )
                logical_cores_for_ccl = False
                break
        for pool in cpu_pools:
            domain_binary = 0
            cores = []
            if logical_cores_for_ccl:
                affinity.extend(
                    [str(c.cpu) for c in pool if not c.is_physical_core][
                        :ccl_worker_count
                    ]
                )
                cores = [str(c.cpu) for c in pool if c.is_physical_core]
            else:
                physical_cores = [str(c.cpu) for c in pool if c.is_physical_core]
                assert ccl_worker_count < len(
                    physical_cores
                ), f"ccl_worker_count ({ccl_worker_count}) cannot exceed number of available cores ({len(physical_cores)})."
                affinity.extend(physical_cores[:ccl_worker_count])
                cores = physical_cores[ccl_worker_count:]
            for c in cores:
                domain_binary |= 1 << int(c)
            domain_binaries.append(hex(domain_binary))
        return {
            "pin_domain": f'[{",".join(domain_binaries)}]',
            "affinity": ",".join(affinity),
        }

        I_MPI_PIN_DOMAIN specify the cores used for every MPI process.
        1) use physical core for oneccl
           The first ccl_worker_count cores of every rank for ccl communication
           and the other cores will be used to do computation.
           For example: on CascadeLake 8280 CPU, 2 ranks on one node. ccl_worker_count=4
           CCL_WORKER_COUNT=4
           CCL_WORKER_AFFINITY="0,1,2,3,28,29,30,31"
           I_MPI_PIN_DOMAIN=[0xffffff0,0xffffff00000000]
        2) use logical core oneccl
           The first ccl_worker_count logical cores which is correponding to the
           first ccl_worker_count physical cores are used as the ccl cores.
           For example: on CascadeLake 8280 CPU, 2 ranks on one node. ccl_worker_count=4
           CCL_WORKER_COUNT=4
           CCL_WORKER_AFFINITY="56,57,58,59,84,85,86,87"
           I_MPI_PIN_DOMAIN=[0xfffffff,0xfffffff0000000]
        
intel_extension_for_pytorch/cpu/launch/launcher_distributed.py