File: TiledArray

package info (click to toggle)
mpqc3 0.0~git20170114-4
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 148,788 kB
  • ctags: 40,140
  • sloc: cpp: 545,687; ansic: 13,220; perl: 5,065; fortran: 1,990; lisp: 1,269; python: 717; yacc: 392; sh: 304; f90: 238; lex: 184; xml: 182; makefile: 106
file content (70 lines) | stat: -rw-r--r-- 2,769 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# -*- mode: cmake -*-

###################
# Find TiledArray
###################

find_package(TiledArray CONFIG COMPONENTS tiledarray)

if (TILEDARRAY_FOUND)

  set(MPQC_HAS_TILEDARRAY TRUE)
  set(MPQC_HAS_MADNESS TRUE)
  message(STATUS "Found TiledArray:")
  message(STATUS "\tTiledArray_INCLUDE_DIR=${TILEDARRAY_INCLUDE_DIRS}")
  message(STATUS "\tTiledArray_LIBRARIES=${TILEDARRAY_LIBRARIES}")
  include_directories(${TILEDARRAY_INCLUDE_DIRS})
  
  # sanity check: try compiling a simple program
  list(APPEND CMAKE_REQUIRED_INCLUDES ${TILEDARRAY_INCLUDE_DIRS})
  list(APPEND CMAKE_REQUIRED_LIBRARIES ${TILEDARRAY_LIBRARIES})
  CHECK_CXX_SOURCE_COMPILES(
    "
    #include <tiledarray.h>
    int main(int argc, char** argv) {
      madness::World& world = madness::initialize(argc, argv);
      std::vector<TiledArray::TiledRange1> tile_ranges;
      size_t tile_bounds[] = {0, 3, 7}; // 2 tiles; N.B. double square brackets due to autoconf madness
      const size_t ntiles = sizeof(tile_bounds)/sizeof(size_t) - 1;
      tile_ranges.push_back(TiledArray::TiledRange1(tile_bounds, tile_bounds+ntiles));
      tile_ranges.push_back(TiledArray::TiledRange1(tile_bounds, tile_bounds+ntiles));
      TiledArray::TiledRange trange_2d(tile_ranges.begin(), tile_ranges.end());
      TiledArray::Array<double,2> array_2d(world, trange_2d);
      TiledArray::Array<double,2> array_2d_tr(array_2d.world(), array_2d.trange());
      array_2d_tr(\"i,j\") = array_2d(\"j,i\");
      return 0;
    }
    "  TILEDARRAY_COMPILES)
  
  if (NOT TILEDARRAY_COMPILES)
    message(FATAL_ERROR "Could not compile TiledArray test program")
  endif()

  if(MADNESS_HAS_ELEMENTAL)
    set(MPQC_HAS_ELEMENTAL ON CACHE INTERNAL "Have Elemental via MADNESS")
  endif(MADNESS_HAS_ELEMENTAL)
  
  # check that MADNESS BLAS/LAPACK interface width agrees with what MPQC assumed
  set(CMAKE_REQUIRED_DEFINITIONS "-DF77_INTEGER_WIDTH=${F77_INTEGER_WIDTH}")
  CHECK_CXX_SOURCE_COMPILES(
    "
    #include <madness/madness_config.h>
    #if MADNESS_FORTRAN_DEFAULT_INTEGER_SIZE != F77_INTEGER_WIDTH
    # error \"MADNESS FORTRAN integer width differs from that of MPQC\"
    #endif
    int main(int argc, char** argv) {
      return 0;
    }
    "  MADNESS_FORTRAN_INTEGER_WIDTH_COMPATIBLE)
  if (NOT MADNESS_FORTRAN_INTEGER_WIDTH_COMPATIBLE)
    if (${F77_INTEGER_WIDTH} STREQUAL 8)
     message(FATAL_ERROR "MADNESS default FORTRAN integer width does not match that of MPQC. You need to omit --integer8 configure flag.")
    else()
      message(FATAL_ERROR "MADNESS default FORTRAN integer width does not match that of MPQC. You need to add --integer8 configure flag.")
    endif()
  endif()
  
else(TILEDARRAY_FOUND)
  message(FATAL_ERROR " Could not find tiledarray")
endif(TILEDARRAY_FOUND)