Skip to content

Commit

Permalink
fix gcc compilation error
Browse files Browse the repository at this point in the history
  • Loading branch information
iancclin committed Aug 1, 2018
1 parent f615ad1 commit 2c5a26b
Show file tree
Hide file tree
Showing 4 changed files with 151 additions and 114 deletions.
28 changes: 14 additions & 14 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,23 @@ set -o pipefail
# and optimization flag

#Paths for external libraries
dealiiPetscRealDir="/home/vikramg/DFT-FE-softwares/softwareCentos/dealiiDev/intel_18.0.1_petscReal_avx_64bit_mklthread_scalapack"
dealiiPetscComplexDir="/home/vikramg/DFT-FE-softwares/softwareCentos/dealiiDev/intel_18.0.1_petscComplex_avx_64bit_mklthread_scalapack"
alglibDir="/nfs/mcfs_comp/home/rudraa/software/alglib/cpp/src"
libxcDir="/home/vikramg/DFT-FE-softwares/softwareCentos/libxcNew/install_intel18"
spglibDir="/home/vikramg/DFT-FE-softwares/softwareCentos/spglib"
xmlIncludeDir="/usr/include/libxml2"
xmlLibDir="/usr/lib64"
dealiiPetscRealDir="/home/iancclin/dftfe/dealii_real"
dealiiPetscComplexDir="/home/iancclin/dftfe/dealii_complex"
alglibDir="/home/iancclin/dftfe/alglib/cpp/src"
libxcDir="/home/iancclin/dftfe/libxc"
spglibDir="/home/iancclin/dftfe/spglib"
xmlIncludeDir="/home/iancclin/dftfe/libxml2/include/libxml2"
xmlLibDir="/home/iancclin/dftfe/libxml2/lib"

#If you have installed dealii by linking with intel mkl library set underlying flag to "ON",
#otherwise set it to "OFF"
withIntelMkl=ON
withIntelMkl=OFF

#Compiler options and flags
c_compiler=mpicc
cxx_compiler=mpicxx
c_flagsRelease=-O2
cxx_flagsRelease=-O2
c_flagsRelease="-O2 -fpermissive"
cxx_flagsRelease="-O2 -fpermissive"

#Optmization flag: 1 for optimized mode and 0 for debug mode compilation
optimizedMode=1
Expand All @@ -41,18 +41,18 @@ if [ $optimizedMode == 1 ]; then
cd build
cd release
echo -e "${Blu}Building Real executable in Optimized (Release) mode...${RCol}"
mkdir -p real && cd real && cmake -DCMAKE_C_COMPILER=$c_compiler -DCMAKE_CXX_COMPILER=$cxx_compiler -DCMAKE_CXX_FLAGS_RELEASE=$cxx_flagsRelease -DCMAKE_C_FLAGS_RELEASE=$c_flagsRelease -DCMAKE_BUILD_TYPE=Release -DDEAL_II_DIR=$dealiiPetscRealDir -DALGLIB_DIR=$alglibDir -DLIBXC_DIR=$libxcDir -DSPGLIB_DIR=$spglibDir -DXML_LIB_DIR=$xmlLibDir -DXML_INCLUDE_DIR=$xmlIncludeDir -DWITH_INTEL_MKL=$withIntelMkl ../../../. && make -j 4 && cd ..
mkdir -p real && cd real && cmake -DCMAKE_C_COMPILER=$c_compiler -DCMAKE_CXX_COMPILER=$cxx_compiler -DCMAKE_CXX_FLAGS_RELEASE="$cxx_flagsRelease" -DCMAKE_C_FLAGS_RELEASE="$c_flagsRelease" -DCMAKE_BUILD_TYPE=Release -DDEAL_II_DIR=$dealiiPetscRealDir -DALGLIB_DIR=$alglibDir -DLIBXC_DIR=$libxcDir -DSPGLIB_DIR=$spglibDir -DXML_LIB_DIR=$xmlLibDir -DXML_INCLUDE_DIR=$xmlIncludeDir -DWITH_INTEL_MKL=$withIntelMkl ../../../. && make -j 4 && cd ..
echo -e "${Blu}Building Complex executable in Optimized (Release) mode...${RCol}"
mkdir -p complex && cd complex && cmake -DCMAKE_C_COMPILER=$c_compiler -DCMAKE_CXX_COMPILER=$cxx_compiler -DCMAKE_CXX_FLAGS_RELEASE=$cxx_flagsRelease -DCMAKE_C_FLAGS_RELEASE=$c_flagsRelease -DCMAKE_BUILD_TYPE=Release -DDEAL_II_DIR=$dealiiPetscComplexDir -DALGLIB_DIR=$alglibDir -DLIBXC_DIR=$libxcDir -DSPGLIB_DIR=$spglibDir -DXML_LIB_DIR=$xmlLibDir -DXML_INCLUDE_DIR=$xmlIncludeDir -DWITH_INTEL_MKL=$withIntelMkl ../../../. && make -j 4 && cd ../..
mkdir -p complex && cd complex && cmake -DCMAKE_C_COMPILER=$c_compiler -DCMAKE_CXX_COMPILER=$cxx_compiler -DCMAKE_CXX_FLAGS_RELEASE="$cxx_flagsRelease" -DCMAKE_C_FLAGS_RELEASE="$c_flagsRelease" -DCMAKE_BUILD_TYPE=Release -DDEAL_II_DIR=$dealiiPetscComplexDir -DALGLIB_DIR=$alglibDir -DLIBXC_DIR=$libxcDir -DSPGLIB_DIR=$spglibDir -DXML_LIB_DIR=$xmlLibDir -DXML_INCLUDE_DIR=$xmlIncludeDir -DWITH_INTEL_MKL=$withIntelMkl ../../../. && make -j 4 && cd ../..
else
rm -rf build/release
echo -e "${Blu}Creating build directory...${RCol}"
mkdir -p build && cd build
mkdir -p release && cd release
echo -e "${Blu}Building Real executable in Optimized (Release) mode...${RCol}"
mkdir -p real && cd real && cmake -DCMAKE_C_COMPILER=$c_compiler -DCMAKE_CXX_COMPILER=$cxx_compiler -DCMAKE_CXX_FLAGS_RELEASE=$cxx_flagsRelease -DCMAKE_C_FLAGS_RELEASE=$c_flagsRelease -DCMAKE_BUILD_TYPE=Release -DDEAL_II_DIR=$dealiiPetscRealDir -DALGLIB_DIR=$alglibDir -DLIBXC_DIR=$libxcDir -DSPGLIB_DIR=$spglibDir -DXML_LIB_DIR=$xmlLibDir -DXML_INCLUDE_DIR=$xmlIncludeDir -DWITH_INTEL_MKL=$withIntelMkl ../../../. && make -j 4 && cd ..
mkdir -p real && cd real && cmake -DCMAKE_C_COMPILER=$c_compiler -DCMAKE_CXX_COMPILER=$cxx_compiler -DCMAKE_CXX_FLAGS_RELEASE="$cxx_flagsRelease" -DCMAKE_C_FLAGS_RELEASE="$c_flagsRelease" -DCMAKE_BUILD_TYPE=Release -DDEAL_II_DIR=$dealiiPetscRealDir -DALGLIB_DIR=$alglibDir -DLIBXC_DIR=$libxcDir -DSPGLIB_DIR=$spglibDir -DXML_LIB_DIR=$xmlLibDir -DXML_INCLUDE_DIR=$xmlIncludeDir -DWITH_INTEL_MKL=$withIntelMkl ../../../. && make -j 4 && cd ..
echo -e "${Blu}Building Complex executable in Optimized (Release) mode...${RCol}"
mkdir -p complex && cd complex && cmake -DCMAKE_C_COMPILER=$c_compiler -DCMAKE_CXX_COMPILER=$cxx_compiler -DCMAKE_CXX_FLAGS_RELEASE=$cxx_flagsRelease -DCMAKE_BUILD_TYPE=Release -DDEAL_II_DIR=$dealiiPetscComplexDir -DALGLIB_DIR=$alglibDir -DLIBXC_DIR=$libxcDir -DSPGLIB_DIR=$spglibDir -DXML_LIB_DIR=$xmlLibDir -DXML_INCLUDE_DIR=$xmlIncludeDir -DWITH_INTEL_MKL=$withIntelMkl ../../../. && make -j 4 && cd ../..
mkdir -p complex && cd complex && cmake -DCMAKE_C_COMPILER=$c_compiler -DCMAKE_CXX_COMPILER=$cxx_compiler -DCMAKE_CXX_FLAGS_RELEASE="$cxx_flagsRelease" -DCMAKE_BUILD_TYPE=Release -DDEAL_II_DIR=$dealiiPetscComplexDir -DALGLIB_DIR=$alglibDir -DLIBXC_DIR=$libxcDir -DSPGLIB_DIR=$spglibDir -DXML_LIB_DIR=$xmlLibDir -DXML_INCLUDE_DIR=$xmlIncludeDir -DWITH_INTEL_MKL=$withIntelMkl ../../../. && make -j 4 && cd ../..
fi
else
if [ -d "build/debug" ]; then
Expand Down
21 changes: 18 additions & 3 deletions src/dft/dft.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1475,11 +1475,16 @@ namespace dftfe {
dealii::parallel::distributed::Vector<double> rhoNodalField;
matrix_free_data.initialize_dof_vector(rhoNodalField,densityDofHandlerIndex);
rhoNodalField=0;
std::function<double(const typename dealii::DoFHandler<3>::active_cell_iterator & cell ,
const unsigned int q)> funcRho =
[&](const typename dealii::DoFHandler<3>::active_cell_iterator & cell ,
const unsigned int q)
{return (*rhoOutValues).find(cell->id())->second[q];};
dealii::VectorTools::project<3,dealii::parallel::distributed::Vector<double>> (dealii::MappingQ1<3,3>(),
dofHandler,
constraintsNone,
QGauss<3>(C_num1DQuad<FEOrder>()),
[&](const typename dealii::DoFHandler<3>::active_cell_iterator & cell , const unsigned int q) -> double {return (*rhoOutValues).find(cell->id())->second[q];},
funcRho,
rhoNodalField);
rhoNodalField.update_ghost_values();

Expand All @@ -1489,22 +1494,32 @@ namespace dftfe {
{
matrix_free_data.initialize_dof_vector(rhoNodalFieldSpin0,densityDofHandlerIndex);
rhoNodalFieldSpin0=0;
std::function<double(const typename dealii::DoFHandler<3>::active_cell_iterator & cell ,
const unsigned int q)> funcRhoSpin0 =
[&](const typename dealii::DoFHandler<3>::active_cell_iterator & cell ,
const unsigned int q)
{return (*rhoOutValuesSpinPolarized).find(cell->id())->second[2*q];};
dealii::VectorTools::project<3,dealii::parallel::distributed::Vector<double>> (dealii::MappingQ1<3,3>(),
dofHandler,
constraintsNone,
QGauss<3>(C_num1DQuad<FEOrder>()),
[&](const typename dealii::DoFHandler<3>::active_cell_iterator & cell , const unsigned int q) -> double {return (*rhoOutValuesSpinPolarized).find(cell->id())->second[2*q];},
funcRhoSpin0,
rhoNodalFieldSpin0);
rhoNodalFieldSpin0.update_ghost_values();


matrix_free_data.initialize_dof_vector(rhoNodalFieldSpin1,densityDofHandlerIndex);
rhoNodalFieldSpin1=0;
std::function<double(const typename dealii::DoFHandler<3>::active_cell_iterator & cell ,
const unsigned int q)> funcRhoSpin1 =
[&](const typename dealii::DoFHandler<3>::active_cell_iterator & cell ,
const unsigned int q)
{return (*rhoOutValuesSpinPolarized).find(cell->id())->second[2*q+1];};
dealii::VectorTools::project<3,dealii::parallel::distributed::Vector<double>> (dealii::MappingQ1<3,3>(),
dofHandler,
constraintsNone,
QGauss<3>(C_num1DQuad<FEOrder>()),
[&](const typename dealii::DoFHandler<3>::active_cell_iterator & cell , const unsigned int q) -> double {return (*rhoOutValuesSpinPolarized).find(cell->id())->second[2*q+1];},
funcRhoSpin1,
rhoNodalFieldSpin1);
rhoNodalFieldSpin1.update_ghost_values();
}
Expand Down
30 changes: 27 additions & 3 deletions src/dft/initRho.cc
Original file line number Diff line number Diff line change
Expand Up @@ -564,38 +564,62 @@ void dftClass<FEOrder>::computeNodalRhoFromQuadData()
//
matrix_free_data.initialize_dof_vector(d_rhoNodalField,densityDofHandlerIndex);
d_rhoNodalField=0;

std::function<double(const typename dealii::DoFHandler<3>::active_cell_iterator & cell ,
const unsigned int q)> funcRho =
[&](const typename dealii::DoFHandler<3>::active_cell_iterator & cell ,
const unsigned int q)
{return (*rhoOutValues).find(cell->id())->second[q];};

dealii::VectorTools::project<3,dealii::parallel::distributed::Vector<double>>
(dealii::MappingQ1<3,3>(),
dofHandler,
constraintsNone,
QGauss<3>(C_num1DQuad<FEOrder>()),
[&](const typename dealii::DoFHandler<3>::active_cell_iterator & cell , const unsigned int q) -> double {return (*rhoOutValues).find(cell->id())->second[q];},
funcRho,
d_rhoNodalField);

d_rhoNodalField.update_ghost_values();


if (dftParameters::spinPolarized==1)
{
matrix_free_data.initialize_dof_vector(d_rhoNodalFieldSpin0,densityDofHandlerIndex);
d_rhoNodalFieldSpin0=0;

std::function<double(const typename dealii::DoFHandler<3>::active_cell_iterator & cell ,
const unsigned int q)> funcRhoSpin0 =
[&](const typename dealii::DoFHandler<3>::active_cell_iterator & cell ,
const unsigned int q)
{return (*rhoOutValuesSpinPolarized).find(cell->id())->second[2*q];};

dealii::VectorTools::project<3,dealii::parallel::distributed::Vector<double>>
(dealii::MappingQ1<3,3>(),
dofHandler,
constraintsNone,
QGauss<3>(C_num1DQuad<FEOrder>()),
[&](const typename dealii::DoFHandler<3>::active_cell_iterator & cell , const unsigned int q) -> double {return (*rhoOutValuesSpinPolarized).find(cell->id())->second[2*q];},
funcRhoSpin0,
d_rhoNodalFieldSpin0);

d_rhoNodalFieldSpin0.update_ghost_values();

matrix_free_data.initialize_dof_vector(d_rhoNodalFieldSpin1,densityDofHandlerIndex);
d_rhoNodalFieldSpin1=0;

std::function<double(const typename dealii::DoFHandler<3>::active_cell_iterator & cell ,
const unsigned int q)> funcRhoSpin1 =
[&](const typename dealii::DoFHandler<3>::active_cell_iterator & cell ,
const unsigned int q)
{return (*rhoOutValuesSpinPolarized).find(cell->id())->second[2*q+1];};

dealii::VectorTools::project<3,dealii::parallel::distributed::Vector<double>>
(dealii::MappingQ1<3,3>(),
dofHandler,
constraintsNone,
QGauss<3>(C_num1DQuad<FEOrder>()),
[&](const typename dealii::DoFHandler<3>::active_cell_iterator & cell , const unsigned int q) -> double {return (*rhoOutValuesSpinPolarized).find(cell->id())->second[2*q+1];},
funcRhoSpin1,
d_rhoNodalFieldSpin1);

d_rhoNodalFieldSpin1.update_ghost_values();
}
}
Expand Down
Loading

0 comments on commit 2c5a26b

Please sign in to comment.