core icon indicating copy to clipboard operation
core copied to clipboard

Refactor Capstone support

Open bobpaw opened this issue 1 year ago • 3 comments

Refactor Capstone support

apf_cap

  • move MeshCAP implementation into apfCAP.cc.
  • document functions and add documentation group.
  • remove unused/obsolete capMesh and capEntity forward declarations.
  • forward declare function arguments to reduce translation unit dependencies.
  • add functions to create a Capstone apf::Mesh2 from an existing gmi_model, load by mesh name, generate a mesh with Capstone meshing, and create empty meshes.
  • add model ownership like with MDS.
  • remove fake castEntity function
  • add hasCAP to query support programmatically.
  • always setup full adjacencies when loading Capstone meshes.
  • only destroy the associated model if it exists and is owned.

gmi_cap

  • remove using namespace declarations from the global scope
  • remove most #includes in favor of forward declaration.
    • left in CreateMG_Framework_Geometry.h because I don't think I can forward declare toGmiEntity/fromGmiEntity arguments (i.e. CreateMG::M_GTopo).
  • document all functions and add documentation group.
  • add functions to probe, write, or load specific associated meshes from CRE files.
  • gmi_cap is now the preferred way to interact (load/write) with CRE files.
  • gmi_cap_start and gmi_cap_stop actually do things now (previously they were no-ops).
    • they load/unload an internal CapstoneModule for interaction with Capstone APIs
  • if models are owned (loaded with gmi_cap) they will call the Capstone API to delete the underlying model when destroyed.
  • base APIs (start, stop, register, load, write) are still C interfaces, but the extended ones (probe, load_selective, export, import) are C++ only.

test cases

  • Add capProbe and capLoadSome cases to test new APIs
  • Rewrite capVol to use new APIs, support parallel adaptation with intermediate MDS object, rework argument parsing, and change the names of output VTKs.
  • update the capVolSizeFields to work in parallel (namely CylBoundaryLayer).
  • add a new cube shock size field for capVol and make it the default given option 3.
  • Rewrite cap2vtk, capGeomTest, capCheckParam, cap_closestPoint, cap_inClosureOf tests to use new APIs.

bobpaw avatar Sep 13 '24 15:09 bobpaw

Running into problem with empty parts after --fixLargeAngles. Likely related to #198.

bobpaw avatar Jun 19 '25 06:06 bobpaw

This occurred with the capVol wing case with METIS on 4 procs.

Log for mpirun -np 4 ./capVol -gm 3 wing_surf_only.cre out.cre

Initalization of MetricInterpolation ...
Initalization of MetricInterpolation ...
Threads : 1
Threads : 1
Initalization of MetricInterpolation ...
Initalization of MetricInterpolation ...
Threads : 1Threads : 1

Expiration Date = 2025-8-26 Expiration Date = 2025-8-26 Expiration Date = 2025-8-26 Expiration Date = 2025-8-26 Number of Breps = 1 Number of Breps = 1 Number of Breps = 1 Number of Breps = 1 Loading Data Timer : cpu = 5.924e-03s wall = 7.67e-02s Loading Data Timer : cpu = 5.807e-03s wall = 7.67e-02s Loading Data Timer : cpu = 6.076e-03s wall = 7.67e-02s Loading Data Timer : cpu = 8.435e-03s wall = 7.68e-02s GenerateNMesh : Num Threads = 1 Number of sources : 12 Generating isotropic proxy For iteration:0 marked cells:0 out of:1331 Max source number:12 Average source number:2.7408 Sizing Field Timing : cpu = 1.133e-02s wall = 3.69e-01s Meshing edge 1 Meshing edge 2 Meshing edge 3 Meshing edge 4 Meshing edge 5 Meshing edge 6 Meshing edge 7 Meshing edge 8 Meshing edge 9 Meshing edge 10 Meshing edge 11 Meshing edge 12 Meshing face 1 Meshing face 2 Meshing face 3 Meshing face 4 Meshing face 5 Meshing face 6 Faces Mesher : cpu = 2.343e-02s wall = 2.84e-02s Meshing region 1 Missing edges:0 over:2010 Iter=0 npoin=672 nelem=2037 Iter=1 npoin=673 nelem=2314 Iter=2 npoin=673 nelem=2314 Iter=0 npoin=673 nelem=2314 nface=1340 Iter=1 npoin=1119 nelem=4466 nface=2356 Iter=2 npoin=1121 nelem=4479 nface=1982 Iter=3 npoin=1153 nelem=4686 nface=1004 Iter=4 npoin=1409 nelem=6245 nface=1472 Iter=5 npoin=1413 nelem=6283 nface=1200 Iter=6 npoin=1449 nelem=6499 nface=636 Iter=7 npoin=1583 nelem=7305 nface=844 Iter=8 npoin=1590 nelem=7348 nface=644 Iter=9 npoin=1615 nelem=7497 nface=374 Iter=10 npoin=1664 nelem=7801 nface=396 Iter=11 npoin=1671 nelem=7847 nface=280 Iter=12 npoin=1682 nelem=7915 nface=188 Iter=13 npoin=1695 nelem=7996 nface=142 Iter=14 npoin=1696 nelem=8014 nface=96 Iter=15 npoin=1697 nelem=8025 nface=44 Iter=16 npoin=1697 nelem=8025 nface=14 Worst quality before optim:2900.75 Average quality before optim:2.46743 Iter=0 Edges swapped:480 over:10376 tried:8366 Elements swapped:0 over:8025 tried:30372 Points optimized:592 over:1025 tried:1023 Iter=1 Edges swapped:53 over:10376 tried:6144 Elements swapped:0 over:8025 tried:25745 Points optimized:233 over:1025 tried:922 Iter=2 Edges swapped:6 over:10376 tried:2891 Elements swapped:0 over:8025 tried:15572 Points optimized:97 over:1025 tried:711 Average quality after optim:1.37659 Worst quality after optim:1.91675 Regions Mesher : cpu = 6.954e-01s wall = 7.30e-01s Timing(GenerateNMesh) : cpu = 7.310e-01s wall = 1.13e+00s mesh verified in 0.036884 seconds METIS: weights are not supported METIS: partitioned in 0.003553 seconds METIS: planned in 0.000735 seconds METIS: split in 0.011952 seconds mesh expanded from 1 to 4 parts in 0.003679 seconds mesh migrated from 1 to 4 in 0.051315 seconds writeVtuFile into buffers: 0.001556 seconds writeVtuFile buffers to disk: 0.144549 seconds vtk files before.vtk written in 0.167789 seconds

MeshAdapt: ma::configure: Based on requested sizefield, MeshAdapt requires at least 5 iterations. Setting the number of iteration to 6!

MeshAdapt: version 2.0 ! METIS: weights are not supported METIS: localized graph in 0.000232 seconds METIS: partitioned in 0.004619 seconds METIS: remapped in 0.000094 seconds METIS: scattered in 0.000051 seconds METIS: planned in 0.000422 seconds METIS: migrated in 0.026521 seconds METIS: balanced in 0.037136 seconds

MeshAdapt: iteration 0

MeshAdapt: coarsened 538 edges in 0.230906 seconds METIS: weights are not supported METIS: localized graph in 0.000538 seconds METIS: partitioned in 0.002582 seconds METIS: remapped in 0.000074 seconds METIS: scattered in 0.000027 seconds METIS: planned in 0.000142 seconds METIS: migrated in 0.011190 seconds METIS: balanced in 0.017814 seconds

MeshAdapt: refined 1603 edges in 0.032561 seconds

MeshAdapt: snapped in 0.000494 seconds: 0 targets, 0 non-layer snaps

MeshAdapt: iteration 1

MeshAdapt: coarsened 458 edges in 0.401182 seconds METIS: weights are not supported METIS: localized graph in 0.002649 seconds METIS: partitioned in 0.005030 seconds METIS: remapped in 0.000161 seconds METIS: scattered in 0.000039 seconds METIS: planned in 0.000228 seconds METIS: migrated in 0.025560 seconds METIS: balanced in 0.041595 seconds

MeshAdapt: refined 4695 edges in 0.089507 seconds

MeshAdapt: snapped in 0.000980 seconds: 0 targets, 0 non-layer snaps

MeshAdapt: iteration 2

MeshAdapt: coarsened 1175 edges in 1.189498 seconds METIS: weights are not supported METIS: localized graph in 0.009365 seconds METIS: partitioned in 0.011108 seconds METIS: remapped in 0.000358 seconds METIS: scattered in 0.000066 seconds METIS: planned in 0.000405 seconds METIS: migrated in 0.083376 seconds METIS: balanced in 0.138617 seconds

MeshAdapt: refined 10097 edges in 0.209393 seconds

MeshAdapt: snapped in 0.002037 seconds: 0 targets, 0 non-layer snaps

MeshAdapt: iteration 3

MeshAdapt: coarsened 3976 edges in 2.870489 seconds METIS: weights are not supported METIS: localized graph in 0.021831 seconds METIS: partitioned in 0.021483 seconds METIS: remapped in 0.000682 seconds METIS: scattered in 0.000094 seconds METIS: planned in 0.000864 seconds METIS: migrated in 0.184952 seconds METIS: balanced in 0.306471 seconds

MeshAdapt: refined 14780 edges in 0.388254 seconds

MeshAdapt: snapped in 0.003598 seconds: 0 targets, 0 non-layer snaps

MeshAdapt: iteration 4

MeshAdapt: coarsened 7300 edges in 4.476811 seconds METIS: weights are not supported METIS: localized graph in 0.025776 seconds METIS: partitioned in 0.036831 seconds METIS: remapped in 0.001051 seconds METIS: scattered in 0.000134 seconds METIS: planned in 0.001526 seconds METIS: migrated in 0.236706 seconds METIS: balanced in 0.409361 seconds

MeshAdapt: refined 15780 edges in 0.435036 seconds

MeshAdapt: snapped in 0.004559 seconds: 0 targets, 0 non-layer snaps

MeshAdapt: iteration 5

MeshAdapt: coarsened 10152 edges in 6.280703 seconds METIS: weights are not supported METIS: localized graph in 0.029699 seconds METIS: partitioned in 0.043759 seconds METIS: remapped in 0.001136 seconds METIS: scattered in 0.000149 seconds METIS: planned in 0.002603 seconds METIS: migrated in 0.268942 seconds METIS: balanced in 0.477790 seconds

MeshAdapt: refined 8500 edges in 0.299709 seconds

MeshAdapt: snapped in 0.004292 seconds: 0 targets, 0 non-layer snaps

MeshAdapt: --iter 0 of shape correction loop: #bad elements 166453

MeshAdapt: snapped in 0.005070 seconds: 0 targets, 0 non-layer snaps

MeshAdapt: --fixLargeAngles in 9.376438 seconds: #bad elements 174251

MeshAdapt: --fixShortEdgeElements in 217.924783 seconds: #bad elements 78956 METIS: weights are not supported METIS: localized graph in 0.071383 seconds METIS: partitioned in 0.025649 seconds METIS: remapped in 0.001230 seconds METIS: scattered in 0.000119 seconds METIS: planned in 0.000415 seconds METIS: migrated in 0.592544 seconds METIS: balanced in 0.900624 seconds

MeshAdapt: --percent change in number of bad elements 0.525656

MeshAdapt: --iter 1 of shape correction loop: #bad elements 78956

MeshAdapt: snapped in 0.003536 seconds: 0 targets, 0 non-layer snaps

MeshAdapt: --fixLargeAngles in 4.660544 seconds: #bad elements 78143

MeshAdapt: --fixShortEdgeElements in 123.399546 seconds: #bad elements 37207 METIS: weights are not supported METIS: localized graph in 0.041078 seconds METIS: partitioned in 0.014809 seconds METIS: remapped in 0.000719 seconds METIS: scattered in 0.000078 seconds METIS: planned in 0.000419 seconds METIS: migrated in 0.358449 seconds METIS: balanced in 0.537830 seconds

MeshAdapt: --percent change in number of bad elements 0.528763

MeshAdapt: --iter 2 of shape correction loop: #bad elements 37207

MeshAdapt: snapped in 0.002259 seconds: 0 targets, 0 non-layer snaps

MeshAdapt: --fixLargeAngles in 2.428371 seconds: #bad elements 35320 APF warning: 1 empty parts APF warning: 1 empty parts APF warning: 1 empty parts

MeshAdapt: --fixShortEdgeElements in 71.502453 seconds: #bad elements 16995 METIS: weights are not supported owned_xadj.size() > 1 failed at /users/woodra/lore/projects/capstone/core-capstone/metis/apfMETISbalancer.cc + 37

=================================================================================== = BAD TERMINATION OF ONE OF YOUR APPLICATION PROCESSES = PID 2952076 RUNNING AT trouble.scorec.rpi.edu = EXIT CODE: 134 = CLEANING UP REMAINING PROCESSES = YOU CAN IGNORE THE BELOW CLEANUP MESSAGES

YOUR APPLICATION TERMINATED WITH THE EXIT STRING: Aborted (signal 6) This typically refers to a problem with your application. Please see the FAQ page for debugging suggestions

bobpaw avatar Jun 19 '25 18:06 bobpaw

Metis balancing for meshes with empty parts is fixed in #499

bobpaw avatar Jun 23 '25 03:06 bobpaw

@cwsmith please review when you get a chance.

bobpaw avatar Jul 01 '25 14:07 bobpaw

Also might be good to get Jacob's eyes on this since there are substantial API changes and he might have inputs.

bobpaw avatar Jul 01 '25 14:07 bobpaw

/runtests

cwsmith avatar Jul 01 '25 15:07 cwsmith

Build Log Simmetrix Test Result: success Simmetrix + CGNS Test Result: success

github-actions[bot] avatar Jul 01 '25 15:07 github-actions[bot]