Changeset 4953


Ignore:
Timestamp:
Mar 3, 2016, 9:52:05 AM (3 years ago)
Author:
cameron
Message:

Remove BLOCK_SIZE, SIMD checking from CMakeLists.txt, README

Location:
icGREP/icgrep-devel
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/README-icgrep.txt

    r4783 r4953  
    3333(L1) open a terminal window and cd to the llvm-build directory
    3434(L2) enter the following command to build the makefiles
    35 cmake -DCMAKE_INSTALL_PREFIX=../libllvm -DLLVM_TARGETS_TO_BUILD=X86 -DLLVM_BUILD_TOOLS=OFF -DLLVM_BUILD_EXAMPLES=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER:FILEPATH=/usr/bin/clang++ -DCMAKE_C_COMPILER:FILEPATH=/usr/bin/clang ../llvm-3.6.1.src
     35cmake -DCMAKE_INSTALL_PREFIX=../libllvm -DLLVM_TARGETS_TO_BUILD=X86 -DLLVM_BUILD_TOOLS=OFF -DLLVM_BUILD_EXAMPLES=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER:FILEPATH=/usr/bin/clang++ -DCMAKE_C_COMPILER:FILEPATH=/usr/bin/clang ../llvm-3.6.2.src
    3636(L3) Still in the llvm-build directory, enter the commands "make" and then "make install"
    3737
     
    3939system generator.
    4040(IC1)  open a terminal window and cd to the icgrep-build directory
    41 (IC2.1)  enter the following command to build the makefiles
     41(IC2)  enter the following command to build the makefiles
    4242cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER:FILEPATH=/usr/bin/clang++ -DCMAKE_C_COMPILER:FILEPATH=/usr/bin/clang ../icgrep
    43 (IC2.2)  to specify the type of supported SIMD operations rather than relying on auto detection
    44 cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER:FILEPATH=/usr/bin/clang++ -DCMAKE_C_COMPILER:FILEPATH=/usr/bin/clang -DSIMD_SUPPORT=XXX ../icgrep
    45      Where XXX can be SSE2, SSE3, SSE4_1, SSE4_2, AVX1 or AVX2.
    4643(IC3) Enter the command "make"
    4744
  • icGREP/icgrep-devel/icgrep/CMakeLists.txt

    r4949 r4953  
    77set (icgrep_VERSION_MAJOR 1)
    88set (icgrep_VERSION_MINOR 0)
    9 
    10 option(BLOCK_SIZE_256 "Compiling with BLOCK_SIZE=256")
    11 if (BLOCK_SIZE_256)
    12   message("-- Build with BLOCK_SIZE=256")
    13 elseif (NOT BLOCK_SIZE_64)
    14   message("-- Build with BLOCK_SIZE=128")
    15 endif()
    16 
    17 option(BLOCK_SIZE_64 "Compiling with BLOCK_SIZE=64")
    18 if (BLOCK_SIZE_64)
    19   message("-- Build with BLOCK_SIZE=64")
    20 endif()
    219
    2210option(ENABLE_MULTIPLEXING "Compiling the Multiplexing Module")
     
    189177SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
    190178
    191 #Check compiler and system architecture support for SSE or AVX
    192 include(CheckCXXSourceRuns)
    193 
    194 set(SSE1_CODE "
    195 #include <xmmintrin.h>
    196 int main()
    197 {
    198 __m128 a;
    199 float vals[4] = {0,0,0,0};
    200 a = _mm_loadu_ps(vals);
    201 return 0;
    202 }")
    203 
    204 set(SSE2_CODE "
    205 #include <emmintrin.h>
    206 int main()
    207 {
    208 __m128d a;
    209 double vals[2] = {0,0};
    210 a = _mm_loadu_pd(vals);
    211 return 0;
    212 }")
    213 
    214 set(SSE3_CODE "
    215 #include <pmmintrin.h>
    216 int main( )
    217 {
    218 const int vals[4] = {0,0,0,0};
    219 __m128i a;
    220 a = _mm_lddqu_si128( (const __m128i*)vals );
    221 return 0;
    222 }")
    223 
    224 set(SSE4_1_CODE "
    225 #include <smmintrin.h>
    226 int main ()
    227 {
    228 __m128i a, b;
    229 __m128i res = _mm_max_epi8(a, b);
    230 return 0;
    231 }")
    232 
    233 set(SSE4_2_CODE "
    234 #include <nmmintrin.h>
    235 int main()
    236 {
    237 __m128i a, b, c;
    238 c = _mm_cmpgt_epi64(a, b);
    239 return 0;
    240 }")
    241 
    242 set(AVX1_CODE "
    243 #include <immintrin.h>
    244 int main()
    245 {
    246 __m256* a=(__m256*)_mm_malloc(4, 32);
    247 __m256 b = _mm256_load_ps((float*)a);
    248 b = _mm256_or_ps(b, b);
    249 _mm_free(a);
    250 return 0;
    251 }")
    252 
    253 set(AVX2_CODE "
    254 #include <immintrin.h>
    255 int main()
    256 {
    257 __m256i* a = (__m256i*)_mm_malloc(4, 32);
    258 __m256i b = _mm256_load_si256(a);
    259 b = _mm256_or_si256(b, b);
    260 _mm_free(a);
    261 return 0;
    262 }")
    263 
    264 IF (MSVC) # using Visual Studio C++
    265   SET(ENABLE_SSE1 "/arch:SSE")
    266   SET(ENABLE_SSE2 "/arch:SSE2")
    267   SET(ENABLE_SSE3 "/arch:SSE3")
    268   SET(ENABLE_SSE4_1 "/arch:SSE4")
    269   SET(ENABLE_SSE4_2 "/arch:SSE4")
    270   SET(ENABLE_AVX1 "/arch:AVX1")
    271   SET(ENABLE_AVX2 "/arch:AVX2")
    272 ELSE() # using Clang, GCC, Intel C++, etc 
    273   SET(ENABLE_SSE1 "-msse")
    274   SET(ENABLE_SSE2 "-msse2")
    275   SET(ENABLE_SSE3 "-msse3")
    276   SET(ENABLE_SSE4_1 "-msse4.1")
    277   SET(ENABLE_SSE4_2 "-msse4.2")
    278   IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
    279     SET(ENABLE_AVX1 "-mavx -fabi-version=6")
    280     SET(ENABLE_AVX2 "-mavx2 -fabi-version=6") 
    281   ELSE()
    282     SET(ENABLE_AVX1 "-mavx")
    283     SET(ENABLE_AVX2 "-mavx2")
    284   ENDIF()
    285 ENDIF()
    286179
    287180SET(CMAKE_REQUIRED_FLAGS)
    288 
    289 MACRO(CHECK_SIMD_SUPPORT SIMD_TYPE RESULT)
    290   IF(NOT RESULT) 
    291     SET(CMAKE_REQUIRED_FLAGS_SAVE ${CMAKE_REQUIRED_FLAGS})
    292     SET(CMAKE_REQUIRED_FLAGS ${ENABLE_${SIMD_TYPE}})
    293     SET(SUCCESS "${SIMD_TYPE}")
    294     check_cxx_source_runs("${${SIMD_TYPE}_CODE}" ${SUCCESS})   
    295     IF(${SUCCESS})
    296       SET(${RESULT} "${SIMD_TYPE}")
    297     ENDIF()
    298     SET(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS_SAVE})
    299   ENDIF()
    300 ENDMACRO()
    301 
    302 IF(NOT SIMD_SUPPORT)
    303 SET(RESULT)
    304 CHECK_SIMD_SUPPORT("AVX2" RESULT)
    305 CHECK_SIMD_SUPPORT("AVX1" RESULT)
    306 CHECK_SIMD_SUPPORT("SSE4_2" RESULT)
    307 CHECK_SIMD_SUPPORT("SSE4_1" RESULT)
    308 CHECK_SIMD_SUPPORT("SSE3" RESULT)
    309 CHECK_SIMD_SUPPORT("SSE2" RESULT)
    310 CHECK_SIMD_SUPPORT("SSE1" RESULT)
    311 SET(SIMD_SUPPORT ${RESULT} CACHE STRING "SSE2")
    312 ENDIF()
    313 #message("SIMD_SUPPORT=" ${SIMD_SUPPORT})
    314 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ENABLE_${SIMD_SUPPORT}}")
    315181
    316182# detect LLVM version and add compiler flags.
     
    318184  SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUSE_LLVM_3_5")
    319185ENDIF()
    320 
    321 IF (BLOCK_SIZE_256)
    322     IF ("${SIMD_SUPPORT}" STREQUAL "AVX1")
    323         SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUSE_S2P_AVX -DUSE_AVX -DBLOCK_SIZE=256 -mavx -m64")
    324     ELSEIF ("${SIMD_SUPPORT}" STREQUAL "AVX2")
    325         SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUSE_S2P_AVX2 -DBLOCK_SIZE=256 -march=core-avx2 -m64")
    326     ENDIF()
    327 ELSEIF(BLOCK_SIZE_64)
    328     SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBLOCK_SIZE=64")
    329 ELSE ()
    330     SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBLOCK_SIZE=128")
    331 ENDIF()
    332 
    333186
    334187IF (PRINT_TIMING_INFORMATION)   
Note: See TracChangeset for help on using the changeset viewer.