Thread: gcc/clang support for avx

  1. #1
    Tweaking master Aslaville's Avatar
    Join Date
    Sep 2012
    Location
    Rogueport
    Posts
    528

    gcc/clang support for avx

    I have tracked a bug in my code to a piece of code that could be simplified to


    Code:
    /* 
      gcc/clang -std=c++11 -mavx -o file 
    
    */
    
     #include <string>
     #include <vector>
     #include <list>
     
     extern "C"
     {
        #include <pmmintrin.h>
        #include <immintrin.h>
     }
     
    typedef unsigned long u64;
    typedef __m256i u256;
     
     int main( int main, char *argv[])
     {
        std::vector<u256> stack(10);
        std::vector<u64> cstack(10 * 1288);
     }
    This piece of code is seg faulting while initializing the vector(gcc/clang++).Is this behavior expected?

  2. #2
    Registered User
    Join Date
    Jul 2008
    Posts
    38
    I believe you need to have the memory allocated aligned to 32 bytes.

    For more information:

    VMOVAPD

    EDIT:

    Hmm, I am not sure anymore. Does not hurt to try?
    Last edited by Florian; 09-16-2014 at 08:22 AM.

  3. #3
    Registered User
    Join Date
    Apr 2006
    Posts
    2,149
    Can you use deque instead of vector? My guess is it's running into limits on the size of continuous memory.
    It is too clear and so it is hard to see.
    A dunce once searched for fire with a lighted lantern.
    Had he known what fire was,
    He could have cooked his rice much sooner.

  4. #4
    Tweaking master Aslaville's Avatar
    Join Date
    Sep 2012
    Location
    Rogueport
    Posts
    528
    I sorta gave up on this, may be I will look into it later with the time :-)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. need assistance with a valgrind error within clang
    By saldar05 in forum C Programming
    Replies: 2
    Last Post: 03-04-2013, 01:59 AM
  2. Clang vs GCC for Linux/Unix Programming?
    By haziz in forum C Programming
    Replies: 2
    Last Post: 05-07-2012, 12:52 PM
  3. clang++ works but g++ doesn't -- Maybe a compiler bug?
    By RichSelian in forum C++ Programming
    Replies: 2
    Last Post: 07-11-2011, 08:04 PM
  4. C99 support?
    By Devil Panther in forum C Programming
    Replies: 3
    Last Post: 08-22-2005, 02:07 PM
  5. does IIS support PHP?
    By Commander in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 07-24-2002, 03:37 PM