Skip to content

Commit

Permalink
Fix memory issue in permutation array with scotch renum.
Browse files Browse the repository at this point in the history
  • Loading branch information
Algiane committed Oct 29, 2024
1 parent a12d160 commit 7e8a2dd
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
6 changes: 4 additions & 2 deletions cmake/testing/pmmg_tests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -788,13 +788,15 @@ IF( BUILD_TESTING )

foreach( MODE faces )

# Toy geom nosplit: 2 procs, ls_val=0.0 + remesh hsiz 0.1 + 5 iter + multimat nosplit
# Toy geom nosplit: 2 procs, ls_val=0.0 + remesh hsiz 0.1 + 4 iter + multimat nosplit
## Remark : FAIL inside mmg3d scotch renum of iter 5 if niter = 5

SET( NP 2 )
add_test( NAME ls-DisIn-toygeom-nosplit-${MODE}-${NP}
COMMAND ${MPIEXEC} ${MPI_ARGS} ${MPIEXEC_NUMPROC_FLAG} ${NP} $<TARGET_FILE:${PROJECT_NAME}>
${CI_DIR}/LevelSet/${NP}p_toygeom/cube-distributed-${MODE}-mat-edges.mesh -v 5
-f ${CI_DIR}/LevelSet/${NP}p_toygeom/nosplit.mmg3d
-hsiz 0.1 -niter 5
-hsiz 0.1 -niter 4
-ls 0.0
-sol ${CI_DIR}/LevelSet/${NP}p_toygeom/cube-ls.sol
-out ${CI_DIR_RESULTS}/ls-DisIn-toygeom-nosplit-${MODE}-${NP}.o.mesh)
Expand Down
20 changes: 15 additions & 5 deletions src/libparmmg1.c
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,9 @@ int PMMG_parmmglib1( PMMG_pParMesh parmesh )

/** Reset the boundary fields between the old mesh size and the new one (Mmg
* uses this fields assiming they are setted to 0)/ */

permNodGlob = NULL;

for ( i=0; i<parmesh->ngrp; ++i ) {
mesh = parmesh->listgrp[i].mesh;

Expand Down Expand Up @@ -719,7 +722,13 @@ int PMMG_parmmglib1( PMMG_pParMesh parmesh )

#ifdef USE_SCOTCH
/* Allocation of the array that will store the node permutation */
PMMG_MALLOC(parmesh,permNodGlob,mesh->np+1,int,"node permutation",
// npi stores the number of points when we enter Mmg, np stores the
// number of points after adatptation.
// In theorie, here np == npi

assert ( mesh->np == mesh->npi );

PMMG_MALLOC(parmesh,permNodGlob,mesh->npi+1,int,"node permutation",
PMMG_scotch_message(&warnScotch) );
if ( permNodGlob ) {
for ( k=1; k<=mesh->np; ++k ) {
Expand Down Expand Up @@ -832,14 +841,15 @@ int PMMG_parmmglib1( PMMG_pParMesh parmesh )
goto strong_failed;
}

#ifdef USE_SCOTCH
PMMG_DEL_MEM(parmesh,permNodGlob,int,"node permutation");
#endif

if ( !ier ) { break; }

}
/* Reset the mesh->gap field in case Mmg have modified it */
mesh->gap = MMG5_GAP;

#ifdef USE_SCOTCH
PMMG_DEL_MEM(parmesh,permNodGlob,int,"node permutation");
#endif
}

MPI_Allreduce( &ier, &ieresult, 1, MPI_INT, MPI_MIN, parmesh->comm );
Expand Down

0 comments on commit 7e8a2dd

Please sign in to comment.