Hi all, I am having problems parallelizing my case, and I don’t know what happened, I can go over 4 ranks, and if I print the DOFS on each rank, I can see that they are not distributed correctly, leaving some ranks with empty mesh. See my MWE.
import os
import gmsh
from dolfinx import fem, io
from mpi4py import MPI
# --------- #
# CONSTANTS #
# --------- #
MPI_COMM = MPI.COMM_WORLD
CURRENT_FOLDER = os.path.dirname(__file__)
os.chdir(CURRENT_FOLDER)
height = 150 # m
diameter = 6.5 # m
thickness = 0.055 # 55mm
# ------- #
# MESHING #
# ------- #
FIXED_TAG = 1000
BEAM_SURFACE_TAG = 2000
VOLUME_TAG = 4000
ELEMENTS_ORDER = 2
VECTOR_SPACE_DEGREE = 2
def gmsh_tower(h: float, d: float) -> gmsh.model:
gmsh.initialize()
gmsh.option.setNumber("General.Terminal", 0)
model = gmsh.model()
# Recombine tetrahedra to hexahedra
gmsh.option.setNumber("Mesh.RecombinationAlgorithm", 2)
gmsh.option.setNumber("Mesh.RecombineAll", 2)
gmsh.option.setNumber("Mesh.CharacteristicLengthFactor", 0.02)
outer_circle = model.occ.addDisk(0, 0, 0, d / 2, d / 2)
inner_circle = model.occ.addDisk(0, 0, 0, d / 2 - thickness, d / 2 - thickness)
outer = model.occ.extrude([(2, outer_circle)], 0, 0, h, numElements=[1.5*h], recombine=True)
inner = model.occ.extrude([(2, inner_circle)], 0, 0, h, numElements=[1.5*h], recombine=True)
outer_volume = outer[1][1]
inner_volume = inner[1][1]
model.occ.cut([(3, outer_volume)], [(3, inner_volume)])
model.occ.synchronize()
fixed_sf = model.addPhysicalGroup(2, [7], tag=FIXED_TAG)
tip_sf = model.addPhysicalGroup(2, [6,8], tag=BEAM_SURFACE_TAG)
vol = model.addPhysicalGroup(3, [1], tag=VOLUME_TAG)
model.setPhysicalName(2, fixed_sf, "FIXED SURFACE")
model.setPhysicalName(2, tip_sf, "LOAD SURFACE")
model.setPhysicalName(3, vol, "Mesh volume")
model.mesh.setOrder(ELEMENTS_ORDER)
model.mesh.generate(3)
model.mesh.optimize()
gmsh.write("mesh.msh")
return model
model = gmsh_tower(h=height, d=diameter)
domain, cell_markers, facet_markers = io.gmshio.model_to_mesh(model, MPI_COMM, rank=0)
#domain, cell_markers, facet_markers = io.gmshio.read_from_msh("mesh.msh", MPI_COMM, 0, gdim=3)
# -------------- #
# Function Space #
# -------------- #
dim = domain.geometry.dim
V = fem.functionspace(domain, ("Lagrange", VECTOR_SPACE_DEGREE, (dim,)))
bs = V.dofmap.index_map_bs
num_dofs_local = V.dofmap.index_map.size_local
print(f"Rank {domain.comm.rank}, Block size {bs} Num local dofs {num_dofs_local*bs}")
Results:
->$: mpirun -np 2 python mesh.py
Rank 0, Block size 3 Num local dofs 0
Rank 1, Block size 3 Num local dofs 920040
->$: mpirun -np 3 python mesh.py
Rank 2, Block size 3 Num local dofs 0
Rank 0, Block size 3 Num local dofs 0
Rank 1, Block size 3 Num local dofs 920040
->$: mpirun -np 4 python mesh.py
Rank 0, Block size 3 Num local dofs 0
Rank 2, Block size 3 Num local dofs 0
Rank 1, Block size 3 Num local dofs 462030
Rank 3, Block size 3 Num local dofs 458010
Going over 4 ranks the script freezes and never returns. This is my DOLFINx version:
In [2]: dolfinx.__version__
Out[2]: '0.8.0'
And my lscpu
which shows that I have enough power to handle more than 4 threads, also I test on another PC with same results
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Address sizes: 46 bits physical, 48 bits virtual
Byte Order: Little Endian
CPU(s): 36
On-line CPU(s) list: 0-35
Vendor ID: GenuineIntel
Model name: Intel(R) Xeon(R) W-2195 CPU @ 2.30GHz
CPU family: 6
Model: 85
Thread(s) per core: 2
Core(s) per socket: 18
Socket(s): 1
Stepping: 4
CPU(s) scaling MHz: 28%
CPU max MHz: 4300.0000
CPU min MHz: 1000.0000
BogoMIPS: 4599.93
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs b
ts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_
deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 cdp_l3 pti intel_ppin ssbd mba ibrs ibpb stibp tpr_shadow flexpriority ept vpid ept_ad fsgsbase
tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm mpx rdt_a avx512f avx512dq rdseed adx smap clflushopt clwb intel_pt avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cq
m_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida arat pln pts hwp hwp_act_window hwp_epp hwp_pkg_req vnmi md_clear flush_l1d arch_capabilities
Virtualization features:
Virtualization: VT-x
Caches (sum of all):
L1d: 576 KiB (18 instances)
L1i: 576 KiB (18 instances)
L2: 18 MiB (18 instances)
L3: 24.8 MiB (1 instance)
NUMA:
NUMA node(s): 1
NUMA node0 CPU(s): 0-35
Vulnerabilities:
Gather data sampling: Mitigation; Microcode
Itlb multihit: KVM: Mitigation: VMX disabled
L1tf: Mitigation; PTE Inversion; VMX conditional cache flushes, SMT vulnerable
Mds: Mitigation; Clear CPU buffers; SMT vulnerable
Meltdown: Mitigation; PTI
Mmio stale data: Mitigation; Clear CPU buffers; SMT vulnerable
Reg file data sampling: Not affected
Retbleed: Mitigation; IBRS
Spec rstack overflow: Not affected
Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl
Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Spectre v2: Mitigation; IBRS; IBPB conditional; STIBP conditional; RSB filling; PBRSB-eIBRS Not affected; BHI Not affected
Srbds: Not affected
Tsx async abort: Mitigation; Clear CPU buffers; SMT vulnerable