Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parallel opendf #8

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ option(AutoSetCXX11 "Auto set c++11 flags" ON)
if (AutoSetCXX11)
set_cxx11()
endif (AutoSetCXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBOOST_MATH_DISABLE_FLOAT128")
# Print build type
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")

Expand All @@ -28,9 +29,7 @@ find_package(ALPSCore REQUIRED COMPONENTS hdf5 accumulators mc params HINTS ${AL

# Dependencies
add_alpscore()
if (NOT ALPSCore_HAS_EIGEN_VERSION)
add_eigen3()
endif (NOT ALPSCore_HAS_EIGEN_VERSION)
add_eigen3()
add_gftools()
option(BuildPython "Build python modules" OFF)
if (BuildPython)
Expand All @@ -46,9 +45,6 @@ endif()
# fftw3
add_fftw3()

# https://stackoverflow.com/questions/25365160/boostmultiprecisionfloat128-and-c11
add_definitions("-fext-numeric-literals")

### add source/binary root of the project to included path
include_directories(
${CMAKE_SOURCE_DIR}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ hub_df_cubicNd --help
```

### Dependencies:
- c++11 - compatible c++ compiler
- c++11 - compatible c++ compiler; To link to the current ALPSCore, set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBOOST_MATH_DISABLE_FLOAT128")
- *cmake*
- *eigen3* (header-only) : http://eigen.tuxfamily.org/. CMake option: `-DEIGEN3_INCLUDE_DIR=path_to_eigen3_headers`.
- *fftw*. Cmake option : `-DFFTW_ROOT=path_to_fftw_prefix` (that is before include or lib).
Expand Down
1 change: 1 addition & 0 deletions build.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CC=mpicc CXX=mpicxx HDF5_ROOT=$HOME/software/install cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$HOME/triangular_project/install -DFFTW_ROOT=$HOME/software/fftw-3.3.8/install -DNFFT3_ROOT=$HOME/software/install/ -DEIGEN3_INCLUDE_DIR=$HOME/software/install/include/eigen3 -DBOOST_ROOT=$HOME/software/install -DBoost_NO_SYSTEM_PATHS=ON -DBoost_NO_BOOST_CMAKE=ON -DLAPACK_LIBRARIES=$HOME/software/OpenBLAS/libopenblas.so.0 -DBLAS_LIBRARIES=$HOME/software/OpenBLAS/libopenblas.so.0 -DALPSCore_DIR=$HOME/software/ALPSCore_dir/install/share/ALPSCore/ ..
1 change: 1 addition & 0 deletions include/opendf/df_hubbard.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once
#include "opendf/df_base.hpp"


namespace open_df {

/// Dual fermion evaluation of a spin-symmetric Hubbard model without spatial symmetry breaking
Expand Down
2 changes: 1 addition & 1 deletion include/opendf/lattice_traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ struct triangular_traits : lattice_traits_base<2,triangular_traits> {
real_type _tp = 1.0;
triangular_traits(real_type t, real_type tp):_t(t),_tp(tp){};

real_type dispersion(real_type kx,real_type ky){return -2.*_t*(cos(kx)+cos(ky)) - 2.*_tp*cos(kx-ky);};
real_type dispersion(real_type kx,real_type ky){return -2.*_t*cos(kx) - 2.0*_t*cos(ky) - 2.*_tp*cos(kx-ky);};
real_type dispersion(typename base::arg_tuple x) { return base::dispersion(x); }
real_type dispersion(typename base::bz_point x) { return base::dispersion(x); }
real_type disp_square_sum(){return 4.*_t*_t + 2.*_tp*_tp;};
Expand Down
2 changes: 1 addition & 1 deletion prog/data_save.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ void save_data(SCType const& sc, typename SCType::gw_type new_delta, alps::param

// add here points for fluctuation diagnostics
fluct_pts.reserve(4);
// add pi/2 pi/2
// add pi/2 pi/2Raman demo session
bz_point p1 = gftools::tuple_tools::repeater<kmesh::point, D>::get_array(k_pi_half);
fluct_pts.push_back(p1);
// add pi, 0
Expand Down
42 changes: 29 additions & 13 deletions prog/hub_df.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

#include <chrono>
#include <alps/params.hpp>
//#include "alps/hdf5.hpp"


#include <opendf/lattice_traits.hpp>
#include <opendf/df_hubbard.hpp>
Expand Down Expand Up @@ -53,19 +55,23 @@ typedef df_type::gw_type gw_type;
typedef df_type::gk_type gk_type;
typedef df_type::disp_type disp_type;

#ifdef OPENDF_ENABLE_MPI
alps::mpi::communicator comm;
#endif

inline void print_section (const std::string& str)
{
std::cout << std::string(str.size(),'=') << std::endl;
std::cout << str << std::endl;
std::cout << std::string(str.size(),'=') << std::endl;
mpi_cout << std::string(str.size(),'=') << std::endl;
mpi_cout << str << std::endl;
mpi_cout << std::string(str.size(),'=') << std::endl;
}

void run(alps::params p)
{
#ifdef OPENDF_ENABLE_MPI
alps::mpi::communicator comm;
#endif
#ifdef OPENDF_ENABLE_MPI
mpi_cout<<"number of process "<<comm.size()<<std::endl;
mpi_cout<<"rank id "<<comm.rank()<<std::endl;
#endif

print_section("DF ladder in " + std::to_string(D) + " dimensions.");
// read input data
Expand Down Expand Up @@ -156,10 +162,11 @@ void run(alps::params p)
end = steady_clock::now();

#ifdef OPENDF_ENABLE_MPI
MPI_Barrier(MPI_COMM_WORLD);
if (!comm.rank())
#endif
{

//std::cout<<"comm.rank "<<comm.rank()<<std::endl;
mpi_cout << "Calculation lasted : "
<< duration_cast<hours>(end-start).count() << "h "
<< duration_cast<minutes>(end-start).count()%60 << "m "
Expand Down Expand Up @@ -189,6 +196,10 @@ void run(alps::params p)
d0.savetxt("density_vertex_input_W0.dat");
}
}

#ifdef OPENDF_ENABLE_MPI
MPI_Barrier(MPI_COMM_WORLD);
#endif
}


Expand All @@ -197,29 +208,34 @@ void run(alps::params p)
//

#ifndef BUILD_PYTHON_MODULE
alps::params cmdline_params(int argc, char* argv[]);
alps::params cmdline_params(int argc, char** argv);

int main(int argc, char *argv[])
{
#ifdef OPENDF_ENABLE_MPI
MPI_Init(&argc, &argv);
#endif

try {
alps::params p = cmdline_params(argc, argv);
run(p);
}
catch (std::exception &e) { std::cerr << e.what() << std::endl; exit(1); };


#ifdef OPENDF_ENABLE_MPI
MPI_Barrier(MPI_COMM_WORLD);
MPI_Finalize();
#endif
}


alps::params cmdline_params(int argc, char* argv[])
alps::params cmdline_params(int argc, char** argv)
{
alps::params p(argc, (const char**)argv);
alps::params p(argc, argv);
p.description("Dual fermions for the Hubbard model in " + std::to_string(D) + " dimensions.");

df_type::define_parameters(p);



save_define_parameters(p);

p
Expand Down
Loading