Skip to content
Snippets Groups Projects
Commit 173c2212 authored by Matteo Cicuttin's avatar Matteo Cicuttin
Browse files

Some C++14 for old nvcc (rhum compat)..

parent 5fca950a
No related branches found
No related tags found
No related merge requests found
......@@ -97,6 +97,9 @@ if (OPT_USE_MPI AND MPI_FOUND)
endif()
######################################################################
## Use or not use GPU solvers
option(OPT_CUDA_USE_CXX14 "Use C++14 (only for rhum compat)" OFF)
option(OPT_ENABLE_GPU_SOLVER "Enable GPU solvers" OFF)
if (OPT_ENABLE_GPU_SOLVER)
add_definitions(-DENABLE_GPU_SOLVER)
......@@ -107,11 +110,16 @@ if (OPT_ENABLE_GPU_SOLVER)
if (CUDAToolkit_FOUND)
set(CMAKE_CUDA_COMPILER ${CUDAToolkit_NVCC_EXECUTABLE})
enable_language(CUDA)
set(CMAKE_CUDA_STANDARD 17)
if (OPT_CUDA_USE_CXX14)
set(CMAKE_CUDA_STANDARD 14)
else()
set(CMAKE_CUDA_STANDARD 17)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Wno-cpp")
endif()
set(CMAKE_CUDA_STANDARD_REQUIRED TRUE)
#set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo --resource-usage -Xptxas -dlcm=ca")
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -lineinfo -prec-div=true \
-Wno-cpp -Xptxas -warn-spills -Xptxas -lineinfo -Xptxas -warn-lmem-usage")
-Xptxas -warn-spills -Xptxas -lineinfo -Xptxas -warn-lmem-usage")
option(OPT_PTXAS_SHOW_RUSAGE "Enable PTXAS resource usage reporting")
if (OPT_PTXAS_SHOW_RUSAGE)
......
......@@ -186,10 +186,12 @@ priv_MPI_Bcast(std::map<T1, std::vector<T2>>& map, int root, MPI_Comm comm)
{
size_t msize = map.size();
MPI_Bcast(&msize, 1, MPI_UNSIGNED_LONG_LONG, root, comm);
for (auto& [l, rv] : map)
//for (auto& [l, rv] : map) /* old nvcc */
for (auto itor = map.begin(); itor != map.end(); itor++)
{
auto ll = l;
MPI_Bcast(&ll, sizeof(T1), MPI_PACKED, root, comm);
auto l = (*itor).first;
auto rv = (*itor).second;
MPI_Bcast(&l, sizeof(T1), MPI_PACKED, root, comm);
size_t vsize = rv.size();
MPI_Bcast(&vsize, 1, MPI_UNSIGNED_LONG_LONG, root, comm);
MPI_Bcast(rv.data(), vsize*sizeof(T2), MPI_PACKED, root, comm);
......
......@@ -326,8 +326,11 @@ public:
void dump(void)
{
for (auto& [key, pair] : face_cell_adj)
//for (auto& [key, pair] : face_cell_adj)
for (auto itor = face_cell_adj.begin(); itor != face_cell_adj.end(); itor++)
{
auto& key = (*itor).first;
auto& pair = (*itor).second;
std::cout << key << ": " << pair.first() << " - " << pair.second() << std::endl;
}
}
......
......@@ -6,6 +6,12 @@
* This code is released under GNU AGPLv3 license, see LICENSE.txt for details.
*/
#if __cplusplus < 201703L
#define CONSTEXPR
#else
#define CONSTEXPR constexpr
#endif
#include "libgmshdg/entity_data.h"
#include "libgmshdg/kernels_gpu.h"
#include "maxwell/maxwell_interface.h"
......@@ -39,7 +45,7 @@ gpu_compute_jumps_kernel(const double * __restrict field,
else
{
double bc_coeff = bcjc[base + flux_ofs];
if constexpr(e_field)
if CONSTEXPR(e_field)
jumps[base + flux_ofs] = bc_coeff*field[idx_mine];
else
jumps[base + flux_ofs] = (2.0 - bc_coeff)*field[idx_mine];
......@@ -380,7 +386,7 @@ gpu_compute_fluxes_kernel_planar(field_gpu::const_raw_ptrs jump, field_gpu::raw_
jHz += + bndsrc.Hz[global_dof_pos];
}
if constexpr(do_E)
if CONSTEXPR(do_E)
{
auto ndotE = nx*jEx + ny*jEy + nz*jEz;
auto aE = face_det * fcp.aE[global_dof_pos];
......@@ -390,7 +396,7 @@ gpu_compute_fluxes_kernel_planar(field_gpu::const_raw_ptrs jump, field_gpu::raw_
flux.Ez[global_dof_pos] = aE*(ny*jHx - nx*jHy) + bE*(ndotE*nz - jEz);
}
if constexpr(do_H)
if CONSTEXPR(do_H)
{
auto ndotH = nx*jHx + ny*jHy + nz*jHz;
auto aH = face_det * fcp.aH[global_dof_pos];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment