Skip to content

Commit 867f9c5

Browse files
authored
Merge pull request #71 from jacobmerson/dev
Building on summit
2 parents 0868fc3 + a9fe4c2 commit 867f9c5

18 files changed

+265
-79
lines changed

CMakeLists.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,8 @@ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Cray")
3939
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "XL")
4040
# todo : check for regular xl vs bg/q xl compiler
4141
# currently assuming bg/q
42-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -qlanglvl=extended0x -O5 -qhot=level=0 -qsimd=auto -qmaxmem=-1 -qstrict -qstrict_induction -qreport")
43-
# these definitions are BGQ specific, but for now the only place we use XL compiler is on BGQ
44-
#add_definitions(-DBGQ)
42+
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -qlanglvl=extended0x")
43+
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -qlanglvl=extended0x -O5 -qhot=level=0 -qsimd=auto -qmaxmem=-1 -qstrict -qstrict_induction -qreport -Wall")
4544
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
4645
# todo : set intel-specific cxx flags
4746
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

core/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ endif()
2626

2727
add_library(las_core STATIC ${las_core_sources})
2828
if(${CMAKE_VERSION} VERSION_GREATER "3.8.2")
29-
target_compile_features(las_core PUBLIC cxx_std_11)
29+
#target_compile_features(las_core PUBLIC cxx_std_11)
3030
endif()
3131
if(MPI_COMPILE_FLAGS)
3232
set_target_properties(las_core PROPERTIES COMPILE_FLAGS ${MPI_CXX_COMPILE_DEFINITIONS})

scripts/config_dcs.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash
2+
#mpicc=/gpfs/u/home/PASC/PASCmrsn/scratch/test_compile/mpicc
3+
#mpicxx=/gpfs/u/home/PASC/PASCmrsn/scratch/test_compile/mpicxx
4+
#mpif77=/gpfs/u/home/PASC/PASCmrsn/scratch/test_compile/mpif77
5+
export OMPI_CXX=xlc++_r
6+
7+
cmake /gpfs/u/home/PASC/PASCmrsn/barn/las/ \
8+
-DCMAKE_C_COMPILER=`which mpicc` \
9+
-DCMAKE_CXX_COMPILER=`which mpicxx` \
10+
-DCMAKE_Fortran_COMPILER=`which mpif77` \
11+
-DCMAKE_EXPORT_COMPILE_COMMANDS=0 \
12+
-DSCOREC_DIR=/gpfs/u/home/PASC/PASCmrsn/scratch/dcs/install/core/lib/cmake/SCOREC/ \
13+
-DCMAKE_BUILD_TYPE=Release \
14+
-DCMAKE_INSTALL_PREFIX=/gpfs/u/home/PASC/PASCmrsn/scratch/dcs/install/las \
15+
-DPETSC_DIR="$PETSC_DIR" \
16+
-DPETSC_ARCH="$PETSC_ARCH" \
17+
-DBUILD_SPARSKIT=ON \
18+
-DWITH_KOKKOS=FALSE \
19+
-DBUILD_TESTS=FALSE \
20+
-DCMAKE_CXX_FLAGS="-Ofast -std=c++11 -Wall" \
21+
-DCMAKE_C_FLAGS="-Ofast -Wall" \
22+
-DCMAKE_Fortran_FLAGS="-Ofast -Wall"
23+
#-DCMAKE_C_FLAGS="-O5" \
24+
#-DCMAKE_CXX_FLAGS="-O5 -sdt=c++11" \
25+
#-DCMAKE_Fortran_FLAGS="-O5" \

scripts/config_erp.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
PREFIX=/gpfs/u/home/PASC/PASCmrsn/scratch/install-erp/las
3+
4+
cmake /gpfs/u/home/PASC/PASCmrsn/barn/las/ \
5+
-DCMAKE_C_COMPILER=`which mpicc` \
6+
-DCMAKE_CXX_COMPILER=`which mpicxx` \
7+
-DCMAKE_Fortran_COMPILER=`which mpif77` \
8+
-DCMAKE_EXPORT_COMPILE_COMMANDS=0 \
9+
-DSCOREC_DIR=/gpfs/u/home/PASC/PASCmrsn/scratch/install-erp/core/lib/cmake/SCOREC/ \
10+
-DCMAKE_BUILD_TYPE=Release \
11+
-DCMAKE_INSTALL_PREFIX="$PREFIX" \
12+
-DPETSC_DIR="$PETSC_DIR" \
13+
-DPETSC_ARCH="$PETSC_ARCH" \
14+
-DBUILD_SPARSKIT=ON \
15+
-DWITH_KOKKOS=FALSE \
16+
-DBUILD_TESTS=FALSE

src/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,11 @@ configure_file(lasConfig.h.in "${CMAKE_CURRENT_SOURCE_DIR}/lasConfig.h" @ONLY)
8989
set(las_headers ${las_headers} ${las_install} lasConfig.h)
9090

9191
add_library(las STATIC ${las_sources})
92-
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "XL")
92+
if("${HOST}" STREQUAL "q.ccni.rpi.edu")
9393
target_compile_definitions(las PUBLIC "-DBGQ")
9494
endif()
9595
if(${CMAKE_VERSION} VERSION_GREATER "3.8.2")
96-
target_compile_features(las PUBLIC cxx_std_11)
96+
#target_compile_features(las PUBLIC cxx_std_11)
9797
endif()
9898
if(CUDA_FOUND)
9999
set_target_properties(las PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
@@ -131,7 +131,7 @@ function(add_backend backend headers libraries)
131131
${CMAKE_CURRENT_BINARY_DIR}/capi/las_capi_${backend}.cc
132132
${headers})
133133
if(${CMAKE_VERSION} VERSION_GREATER "3.8.2")
134-
target_compile_features(${capi_lib} PUBLIC cxx_std_11)
134+
#target_compile_features(${capi_lib} PUBLIC cxx_std_11)
135135
endif()
136136
target_include_directories(${capi_lib} PUBLIC
137137
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>

src/las.h

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,14 @@ namespace las
156156
* @param cm The comm over which the vector is collective.
157157
*/
158158
virtual Vec * create(unsigned lcl, unsigned bs, MPI_Comm cm) = 0;
159+
/**
160+
* Create a vector from an existing array
161+
* @param data The array which the vector will use as data storage
162+
* @param lcl The local number of rows (per-process in cm)
163+
* @param bs The block size (should be the same over cm)
164+
* @param cm The comm over which the vector is collective.
165+
*/
166+
virtual Vec * create(scalar * data, unsigned lcl, unsigned bs, MPI_Comm cm)=0;
159167
virtual void destroy(Vec * v) = 0;
160168
/**
161169
* Create a vector suitable to act as the RHS vector to a
@@ -280,6 +288,30 @@ namespace las
280288
};
281289
template <class T>
282290
ScalarVecMult * getScalarVecMult();
291+
class MatDiagonal
292+
{
293+
public:
294+
virtual void exec(scalar s, Mat * m, Vec *& v) = 0;
295+
virtual ~MatDiagonal() {}
296+
};
297+
template <class T>
298+
MatDiagonal * getMatDiagonal();
299+
class MatDiagonalInverse
300+
{
301+
public:
302+
virtual void exec(scalar s, Mat * m, Vec *& v) = 0;
303+
virtual ~MatDiagonalInverse() {}
304+
};
305+
template <class T>
306+
MatDiagonalInverse * getMatDiagonalInverse();
307+
class HadamardProduct
308+
{
309+
public:
310+
virtual void exec(Vec * v1, Vec * v2, Vec * v3) = 0;
311+
virtual ~HadamardProduct() {}
312+
};
313+
template <class T>
314+
HadamardProduct * getHadamardProduct();
283315
/*
284316
* Finalize routines which must be called on a matrix when switching from
285317
* add mode to set mode

src/lasDense.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ namespace las
1111
lasVec * vb = getLASVec(b);
1212
int nr = dns->getNumRows();
1313
int nc = dns->getNumCols();
14+
#ifndef NDEBUG
1415
int la = va->size();
1516
int lb = vb->size();
17+
#endif
1618
assert(nc == la && "Matrix columns and lhs vector length must match");
1719
assert(nr == lb && "Matrix rows and rhs vector lenght must match");
1820
for(int rw = 0; rw < nr; ++rw)
@@ -29,7 +31,9 @@ namespace las
2931
dnsMat * y = getDnsMat(ym);
3032
int x_nr = x->getNumRows();
3133
int x_nc = x->getNumCols();
34+
#ifndef NDEBUG
3235
int y_nr = y->getNumRows();
36+
#endif
3337
int y_nc = y->getNumCols();
3438
assert(x_nc == y_nr && "Matrix X cols must equal matrix Y rows");
3539
Sparsity * dnsty = createDensity(x_nr,y_nc);

src/lasDense_impl.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,10 @@ namespace las
9999
{
100100
return createVector(lcl);
101101
}
102+
virtual Vec * create(scalar * data, unsigned lcl, unsigned, MPI_Comm)
103+
{
104+
return createVector(data, lcl);
105+
}
102106
virtual void destroy(Vec * v)
103107
{
104108
destroyVector(v);

src/lasInline.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
#define LAS_INLINE inline
66
#elif defined(__INTEL_COMPILER)
77
#define LAS_INLINE __forceinline
8-
#elif defined(__xlc__)
9-
#define LAS_INLINE __attribute__((always_inline))
8+
#elif defined(__xlc__) || defined(__ibmxl__)
9+
#define LAS_INLINE inline __attribute__((always_inline))
1010
#elif defined(__GNUC__) || defined(__GNUG__)
1111
#define LAS_INLINE inline
1212
//__attribute__((always_inline))

src/lasPETSc_impl.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,15 @@ namespace las
230230
CHKERRABORT(LAS_COMM_WORLD, ierr);
231231
return reinterpret_cast<las::Vec*>(v);
232232
}
233+
LAS_INLINE las::Vec * createPetscVector(scalar * data, unsigned l, unsigned bs, MPI_Comm cm = LAS_COMM_WORLD)
234+
{
235+
::Vec * v = new ::Vec;
236+
PetscErrorCode ierr = VecCreateMPIWithArray(cm, bs, l,PETSC_DECIDE,data, v);
237+
CHKERRABORT(LAS_COMM_WORLD, ierr);
238+
ierr = VecSetOption(*v,VEC_IGNORE_NEGATIVE_INDICES,PETSC_TRUE);
239+
CHKERRABORT(LAS_COMM_WORLD, ierr);
240+
return reinterpret_cast<las::Vec*>(v);
241+
}
233242
LAS_INLINE void destroyPetscVec(las::Vec * v)
234243
{
235244
PetscErrorCode ierr = VecDestroy(getPetscVec(v));
@@ -255,6 +264,10 @@ namespace las
255264
{
256265
return createPetscVector(lcl,bs,cm);
257266
}
267+
virtual Vec * create(scalar * data, unsigned lcl, unsigned bs, MPI_Comm cm)
268+
{
269+
return createPetscVector(data, lcl,bs,cm);
270+
}
258271
virtual Vec * createRHS(Mat * m)
259272
{
260273
return createRHSVec(m);
@@ -490,6 +503,7 @@ namespace las
490503
if (c == nullptr)
491504
{
492505
PetscErrorCode ierr = ::MatScale(*getPetscMat(a), s);
506+
CHKERRABORT(LAS_COMM_WORLD, ierr);
493507
}
494508
else
495509
{

0 commit comments

Comments
 (0)