Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
fem
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
gmsh
fem
Commits
a6f2ae82
Commit
a6f2ae82
authored
2 months ago
by
Roland Greffe
Browse files
Options
Downloads
Patches
Plain Diff
fix race condition (all ?) when using gmshddm
parent
3b0f9533
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
CMakeLists.txt
+26
-25
26 additions, 25 deletions
CMakeLists.txt
src/function/executionTree/FunctionAllocator.h
+18
-0
18 additions, 0 deletions
src/function/executionTree/FunctionAllocator.h
src/problem/Formulation.cpp
+2
-2
2 additions, 2 deletions
src/problem/Formulation.cpp
with
46 additions
and
27 deletions
CMakeLists.txt
+
26
−
25
View file @
a6f2ae82
...
@@ -433,6 +433,31 @@ if(ENABLE_MPI)
...
@@ -433,6 +433,31 @@ if(ENABLE_MPI)
endif
()
endif
()
endif
()
endif
()
# Thrust
set
(
Thrust_NVIDIA FALSE
)
set
(
Thrust_ROCm FALSE
)
if
(
ENABLE_DDMGPU
)
if
(
NOT ENABLE_OPENMP
)
message
(
WARNING
"DDMGPU requires OPENMP ! Disabling DDMGPU."
)
set
(
ENABLE_DDMGPU OFF
)
else
()
find_package
(
Thrust
)
#Find it the NVIDIA way
if
(
THRUST_FOUND
)
set
(
Thrust_NVIDIA TRUE
)
thrust_create_target
(
Thrust HOST CPP DEVICE CPP
)
set_config_option
(
"DDMGPU"
DDMGPU
)
# -> GPU DDM USED
else
()
# Try to find rocThrust
find_package
(
rocprim CONFIG PATHS
"/opt/rocm/rocprim"
)
find_package
(
rocthrust CONFIG PATHS
"/opt/rocm/rocthrust"
)
if
(
rocprim_FOUND AND rocthrust_FOUND
)
set
(
Thrust_ROC TRUE
)
set_config_option
(
"DDMGPU"
DDMGPU
)
# -> GPU DDM USED
set
(
Thrust_ROCm TRUE
)
endif
()
endif
()
endif
()
endif
()
# OpenMP
# OpenMP
if
(
ENABLE_OPENMP
)
if
(
ENABLE_OPENMP
)
...
@@ -454,7 +479,7 @@ if(ENABLE_OPENMP)
...
@@ -454,7 +479,7 @@ if(ENABLE_OPENMP)
list
(
APPEND EXTRA_LIBS
"-L/opt/homebrew/opt/libomp/lib -lomp"
)
list
(
APPEND EXTRA_LIBS
"-L/opt/homebrew/opt/libomp/lib -lomp"
)
set_config_option
(
"OpenMP[Homebrew]"
HAVE_OPENMP
)
set_config_option
(
"OpenMP[Homebrew]"
HAVE_OPENMP
)
else
()
else
()
if
(
OPENMP_FOUND
)
if
(
OPENMP_FOUND
AND NOT ENABLE_DDMGPU
)
set_config_option
(
"OpenMP"
HAVE_OPENMP
)
set_config_option
(
"OpenMP"
HAVE_OPENMP
)
endif
()
endif
()
endif
()
endif
()
...
@@ -477,30 +502,6 @@ if(ENABLE_ROBINHOOD)
...
@@ -477,30 +502,6 @@ if(ENABLE_ROBINHOOD)
endif
()
endif
()
endif
()
endif
()
# Thrust
set
(
Thrust_NVIDIA FALSE
)
set
(
Thrust_ROCm FALSE
)
if
(
ENABLE_DDMGPU
)
if
(
ENABLE_OPENMP
)
message
(
WARNING
"DDMGPU and OpenMP are not compatible. Disabling DDMGPU."
)
set
(
ENABLE_DDMGPU OFF
)
else
()
find_package
(
Thrust
)
#Find it the NVIDIA way
if
(
THRUST_FOUND
)
set
(
Thrust_NVIDIA TRUE
)
thrust_create_target
(
Thrust HOST CPP DEVICE CPP
)
set_config_option
(
"DDMGPU"
DDMGPU
)
# -> GPU DDM USED
else
()
# Try to find rocThrust
find_package
(
rocprim CONFIG PATHS
"/opt/rocm/rocprim"
)
find_package
(
rocthrust CONFIG PATHS
"/opt/rocm/rocthrust"
)
if
(
rocprim_FOUND AND rocthrust_FOUND
)
set
(
Thrust_ROC TRUE
)
set_config_option
(
"DDMGPU"
DDMGPU
)
# -> GPU DDM USED
set
(
Thrust_ROCm TRUE
)
endif
()
endif
()
endif
()
endif
()
# Coverage
# Coverage
...
...
This diff is collapsed.
Click to expand it.
src/function/executionTree/FunctionAllocator.h
+
18
−
0
View file @
a6f2ae82
...
@@ -106,9 +106,15 @@ namespace gmshfem::function
...
@@ -106,9 +106,15 @@ namespace gmshfem::function
}
}
T
*
p
=
nullptr
;
T
*
p
=
nullptr
;
if
(
n
*
sizeof
(
value_type
)
<=
GMSHFEM_FUNCTION_MEMORY_ALIGNMENT
)
{
if
(
n
*
sizeof
(
value_type
)
<=
GMSHFEM_FUNCTION_MEMORY_ALIGNMENT
)
{
#ifdef DDMGPU
#pragma omp critical
#endif
p
=
static_cast
<
T
*
>
(
MemoryPoolAllocator
::
instance
()
->
allocateSmall
(
n
*
sizeof
(
value_type
)));
p
=
static_cast
<
T
*
>
(
MemoryPoolAllocator
::
instance
()
->
allocateSmall
(
n
*
sizeof
(
value_type
)));
}
}
else
{
else
{
#ifdef DDMGPU
#pragma omp critical
#endif
p
=
static_cast
<
T
*
>
(
MemoryPoolAllocator
::
instance
()
->
allocate
(
n
*
sizeof
(
value_type
)));
p
=
static_cast
<
T
*
>
(
MemoryPoolAllocator
::
instance
()
->
allocate
(
n
*
sizeof
(
value_type
)));
}
}
...
@@ -122,9 +128,15 @@ namespace gmshfem::function
...
@@ -122,9 +128,15 @@ namespace gmshfem::function
}
}
if
(
n
*
sizeof
(
value_type
)
<=
GMSHFEM_FUNCTION_MEMORY_ALIGNMENT
)
{
if
(
n
*
sizeof
(
value_type
)
<=
GMSHFEM_FUNCTION_MEMORY_ALIGNMENT
)
{
#ifdef DDMGPU
#pragma omp critical
#endif
MemoryPoolAllocator
::
instance
()
->
deallocateSmall
(
p
,
n
*
sizeof
(
value_type
));
MemoryPoolAllocator
::
instance
()
->
deallocateSmall
(
p
,
n
*
sizeof
(
value_type
));
}
}
else
{
else
{
#ifdef DDMGPU
#pragma omp critical
#endif
MemoryPoolAllocator
::
instance
()
->
deallocate
(
p
,
n
*
sizeof
(
value_type
));
MemoryPoolAllocator
::
instance
()
->
deallocate
(
p
,
n
*
sizeof
(
value_type
));
}
}
}
}
...
@@ -142,6 +154,9 @@ namespace gmshfem::function
...
@@ -142,6 +154,9 @@ namespace gmshfem::function
static
T
*
s_p
=
nullptr
;
static
T
*
s_p
=
nullptr
;
#ifdef HAVE_OPENMP
#ifdef HAVE_OPENMP
#pragma omp master
#pragma omp master
#endif
#ifdef DDMGPU
#pragma omp critical
#endif
#endif
s_p
=
static_cast
<
T
*
>
(
MemoryPoolAllocator
::
instance
()
->
allocate
(
n
*
sizeof
(
value_type
)));
s_p
=
static_cast
<
T
*
>
(
MemoryPoolAllocator
::
instance
()
->
allocate
(
n
*
sizeof
(
value_type
)));
#ifdef HAVE_OPENMP
#ifdef HAVE_OPENMP
...
@@ -157,6 +172,9 @@ namespace gmshfem::function
...
@@ -157,6 +172,9 @@ namespace gmshfem::function
#pragma omp barrier
#pragma omp barrier
#pragma omp master
#pragma omp master
#endif
#ifdef DDMGPU
#pragma omp critical
#endif
#endif
MemoryPoolAllocator
::
instance
()
->
deallocate
(
s_p
,
n
*
sizeof
(
value_type
));
MemoryPoolAllocator
::
instance
()
->
deallocate
(
s_p
,
n
*
sizeof
(
value_type
));
#ifdef HAVE_OPENMP
#ifdef HAVE_OPENMP
...
...
This diff is collapsed.
Click to expand it.
src/problem/Formulation.cpp
+
2
−
2
View file @
a6f2ae82
...
@@ -1108,12 +1108,12 @@ namespace gmshfem::problem
...
@@ -1108,12 +1108,12 @@ namespace gmshfem::problem
}
}
time
.
tock
();
time
.
tock
();
msg
::
info
<<
"Done pre-processing in "
<<
time
<<
"s"
<<
msg
::
endl
;
//
msg::info << "Done pre-processing in " << time << "s" << msg::endl;
if
(
common
::
Options
::
instance
()
->
memory
)
{
if
(
common
::
Options
::
instance
()
->
memory
)
{
auto
memory
=
_A
->
memory
();
auto
memory
=
_A
->
memory
();
for
(
auto
&
bi
:
_multiB
)
for
(
auto
&
bi
:
_multiB
)
memory
+=
bi
.
memory
();
memory
+=
bi
.
memory
();
msg
::
info
<<
"Memory footprint of system: "
<<
memory
<<
msg
::
endl
;
//
msg::info << "Memory footprint of system: " << memory << msg::endl;
}
}
return
time
;
return
time
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment