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

alloc.c:269: assertion failed: p #17

Open
proteneer opened this issue Jul 8, 2014 · 12 comments
Open

alloc.c:269: assertion failed: p #17

proteneer opened this issue Jul 8, 2014 · 12 comments

Comments

@proteneer
Copy link

I'm using FFTW 3.3.3, and I'm getting this error on some of the clusters on OSG:

alloc.c:269: assertion failed: p

which corresponds to the #ifdef MIN_ALIGNMENT block:

void *X(malloc_plain)(size_t n)
{
     void *p;
     if (n == 0)
          n = 1;
     p = X(kernel_malloc)(n);
     CK(p);

#ifdef MIN_ALIGNMENT
     A((((uintptr_t)p) % MIN_ALIGNMENT) == 0);
#endif

     return p;
}

These are my build options:

./configure --enable-single --enable-sse2 --enable-avx
--enable-threads --prefix=/home/yutong/fftw_install/

Any ideas?

@stevengj
Copy link
Contributor

stevengj commented Jul 8, 2014

What operating system and compiler are you using?

@proteneer
Copy link
Author

CentOS 6.4, 6.5

On Tuesday, July 8, 2014, Steven G. Johnson notifications@github.com
wrote:

What operating system are you using?


Reply to this email directly or view it on GitHub
#17 (comment).

Yutong Zhao
www.proteneer.com

@stevengj
Copy link
Contributor

stevengj commented Jul 8, 2014

Assuming you are using gcc, try:

cd kernel
rm kalloc.*o
make CC="gcc --save-temps" kalloc.lo

then scroll to the end of the file kalloc.i to the definition of fftwf_kernel_malloc and copy-and-paste it to here.

@proteneer
Copy link
Author

# 26 "kalloc.c" 2
# 71 "kalloc.c"
void *fftwf_kernel_malloc(size_t n)
{
     void *p;
# 91 "kalloc.c"
     p = memalign(32, n);
# 138 "kalloc.c"
     return p;
}

void fftwf_kernel_free(void *p)
{
     free(p);
}

PS - I should mention that I'm trying to build it portably across different linux-based clusters.

@stevengj
Copy link
Contributor

stevengj commented Jul 8, 2014

Is memalign buggy on your system?

Try compiling and running:

#include <stdlib.h>
#include <malloc.h>
#include <stdio.h>

int main(void)
{
    int i;
    for (i = 0; i < 100000; ++i) {
        void *p = memalign(32, rand() % 100 + 1);
        if (((size_t) p) % 32 != 0) {
            fprintf(stderr, "misaligned alloc %p\n", p);
            return 1;
        }
    }
    printf("success.\n");
    return 0;
}

(with gcc memtst.c -o memtst && ./memtst).

@proteneer
Copy link
Author

Let me test this out. We're tested deploying the code on several hundred
heterogenous compute nodes, about 30% of them exhibit this behavior - will
get back to you.

On Tue, Jul 8, 2014 at 8:55 AM, Steven G. Johnson notifications@github.com
wrote:

Is memalign buggy on your system?

Try compiling and running:

#include <stdlib.h>
#include <malloc.h>
#include <stdio.h>

int main(void)
{
int i;
for (i = 0; i < 100000; ++i) {
void *p = memalign(32, rand() % 100 + 1);
if (((size_t) p) % 32 != 0) {
fprintf(stderr, "misaligned alloc %p\n", p);
return 1;
}
}
printf("success.\n");
return 0;
}

(with gcc memtst.c -o memtst && ./memtst).


Reply to this email directly or view it on GitHub
#17 (comment).

Yutong Zhao
www.proteneer.com

@proteneer
Copy link
Author

On one our compute nodes that resulted in the FFTW assertion error, I see:

MEMALIGN TEST
success.

@stevengj
Copy link
Contributor

stevengj commented Jul 9, 2014

@matteo-frigo, any other ideas?

@leeping
Copy link

leeping commented Jul 15, 2014

Hi there,

I'm working with Yutong on figuring out this issue. The following machine has the "assertion failed" error. I'm attaching the CPU info and the end of kalloc.i for this file. The mem align test returns success.

processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 26
model name      : Intel(R) Xeon(R) CPU           E5520  @ 2.27GHz
stepping        : 5
cpu MHz         : 2260.924
cache size      : 8192 KB
physical id     : 1
siblings        : 8
core id         : 0
cpu cores       : 4
apicid          : 16
initial apicid  : 16
fpu             : yes
fpu_exception   : yes
cpuid level     : 11
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm dca sse4_1 sse4_2 popcnt lahf_lm ida dts tpr_shadow vnmi flexpriority ept vpid
bogomips        : 4521.84
clflush size    : 64
cache_alignment : 64
address sizes   : 40 bits physical, 48 bits virtual
power management:
# 26 "kalloc.c" 2
# 71 "kalloc.c"
void *fftwf_kernel_malloc(size_t n)
{
     void *p;
# 91 "kalloc.c"
     p = memalign(32, n);
# 138 "kalloc.c"
     return p;
}

Thanks,

  • Lee-Ping

@stevengj
Copy link
Contributor

On that machine, does FFTW's make check pass? (To rule out the possibility that this is a byproduct of some memory bug in the program from which you are calling FFTW.)

@leeping
Copy link

leeping commented Jul 16, 2014

Output of make check:

--------------------------------------------------------------
         FFTW transforms passed basic tests!
--------------------------------------------------------------
....
--------------------------------------------------------------
         FFTW threaded transforms passed basic tests!
--------------------------------------------------------------

End of kalloc.i:

# 26 "kalloc.c" 2
# 71 "kalloc.c"
void *fftwf_kernel_malloc(size_t n)
{
     void *p;
# 91 "kalloc.c"
     p = memalign(32, n);
# 138 "kalloc.c"
     return p;
}

@stevengj
Copy link
Contributor

If make check passes, then most likely there is some memory-corruption bug in your program that just happens to be showing up in a subsequent call to FFTW.

Maybe try using valgrind or a similar memory debugger?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants