Community
cancel
Showing results for 
Search instead for 
Did you mean: 
kkarco2
Beginner
506 Views

munmap_chunk():invalid pointer

Hi,
I'm trying to test a simple program that uses OpenMP directives along with the threaded MKL library. However, I am getting a runtime error just before the program exits. Below is the error. I've also attached my code and the makefile. I'm not quite sure if there a problem with the libraries I'm linking to. I've set the environment variable OMP_NUM_THREADS=1. I am testing the code on Intel 64 architecture with SUSE Linux Enterprise Server 9.


*** glibc detected *** ./p1: munmap_chunk(): invalid pointer: 0x000000001dc5f0a0 ***
======= Backtrace: =========
/lib64/libc.so.6(cfree+0x166)[0x352d472856]
./p1[0x41560d]
./p1[0x4146c8]
./p1[0x440df7]
./p1[0x4071ae]
./p1[0x403bd1]
/lib64/libc.so.6(__libc_start_main+0xf4)[0x352d41d994]
./p1[0x403ad9]
======= Memory map: ========
00400000-004bd000 r-xp 00000000 00:19 3288420770 /home/kkarco2/FortranPrograms/makefileExample/p1
006bc000-006c4000 rw-p 000bc000 00:19 3288420770 /home/kkarco2/FortranPrograms/makefileExample/p1


I've removed some of the information for the sake of making my post smaller.
Here is my makefile makefile
Here is my mainfile main.f90
And here is an additional file add.f90

Any help is appreciated.

EDIT: I apologize for posting this under the wrong forum.
0 Kudos
2 Replies
barragan_villanueva_
Valued Contributor I
506 Views

Hi,

Your makefile is correct enough (except option -openmp is not needed for sequential MKL case) and I can see usages of ifort compiler option -i8 for MKL ILP64 libraries:

Compiling add.f90
ifort -c -debug full -i8 -openmp -openmp-report1 -fpp -o add.o add.f90
Compiling main.f90
ifort -c -debug full -i8 -openmp -openmp-report1 -fpp -o main.o main.f90
main.f90(62) (col. 7): remark: OpenMP DEFINED LOOP WAS PARALLELIZED.
main.f90(55) (col. 7): remark: OpenMP DEFINED REGION WAS PARALLELIZED.
Linking...
ifort main.o add.o -o p1 -L/.../mkl1026/__release_lnx/lib/em64t/ -lmkl_intel_ilp64 -lmkl_intel_thread -lmkl_core -lpthread -openmp

and output:

% ./p1
A = (1.00000000000000,1.00000000000000)
B = (1.00000000000000,1.00000000000000)
A = (1.00000000000000,2.00000000000000)
B = (2.00000000000000,1.00000000000000)
A = (2.00000000000000,1.00000000000000)
B = (1.00000000000000,2.00000000000000)
A = (2.00000000000000,2.00000000000000)
B = (2.00000000000000,2.00000000000000)
Number of threads = 8
Thread 0 starting...
Thread 7 starting...
Thread 0: C( 1)= 2.00
Thread 0: C( 3)= 6.00
Thread 0: C( 4)= 8.00
Thread 0: C( 5)= 10.00
Thread 0: C( 6)= 12.00
Thread 0: C( 7)= 14.00
Thread 0: C( 8)= 16.00
Thread 0: C( 9)= 18.00
Thread 0: C( 10)= 20.00
Thread 4 starting...
Thread 3 starting...
Thread 1 starting...
Thread 5 starting...
Thread 6 starting...
Thread 2 starting...
Thread 7: C( 2)= 4.00
Thread 0 done.
Thread 4 done.
Thread 5 done.
Thread 7 done.
Thread 2 done.
Thread 1 done.
Thread 3 done.
Thread 6 done.
I am here*****************************
FORTRAN PAUSE

PAUSE prompt>
*** glibc detected *** ./p1: munmap_chunk(): invalid pointer: 0x000000001db0ea60 ***


Root cause of the problem is in your file main.f90 line #29
call add(i,j, N)
where N was changed to N = i + j

However, MatrixMaltiply needs argument N to be equal to 2 according to A,B,C allocations
kkarco2
Beginner
506 Views

Hi,

Your makefile is correct enough (except option -openmp is not needed for sequential MKL case) and I can see usages of ifort compiler option -i8 for MKL ILP64 libraries:

Compiling add.f90
ifort -c -debug full -i8 -openmp -openmp-report1 -fpp -o add.o add.f90
Compiling main.f90
ifort -c -debug full -i8 -openmp -openmp-report1 -fpp -o main.o main.f90
main.f90(62) (col. 7): remark: OpenMP DEFINED LOOP WAS PARALLELIZED.
main.f90(55) (col. 7): remark: OpenMP DEFINED REGION WAS PARALLELIZED.
Linking...
ifort main.o add.o -o p1 -L/.../mkl1026/__release_lnx/lib/em64t/ -lmkl_intel_ilp64 -lmkl_intel_thread -lmkl_core -lpthread -openmp

and output:

% ./p1
A = (1.00000000000000,1.00000000000000)
B = (1.00000000000000,1.00000000000000)
A = (1.00000000000000,2.00000000000000)
B = (2.00000000000000,1.00000000000000)
A = (2.00000000000000,1.00000000000000)
B = (1.00000000000000,2.00000000000000)
A = (2.00000000000000,2.00000000000000)
B = (2.00000000000000,2.00000000000000)
Number of threads = 8
Thread 0 starting...
Thread 7 starting...
Thread 0: C( 1)= 2.00
Thread 0: C( 3)= 6.00
Thread 0: C( 4)= 8.00
Thread 0: C( 5)= 10.00
Thread 0: C( 6)= 12.00
Thread 0: C( 7)= 14.00
Thread 0: C( 8)= 16.00
Thread 0: C( 9)= 18.00
Thread 0: C( 10)= 20.00
Thread 4 starting...
Thread 3 starting...
Thread 1 starting...
Thread 5 starting...
Thread 6 starting...
Thread 2 starting...
Thread 7: C( 2)= 4.00
Thread 0 done.
Thread 4 done.
Thread 5 done.
Thread 7 done.
Thread 2 done.
Thread 1 done.
Thread 3 done.
Thread 6 done.
I am here*****************************
FORTRAN PAUSE

PAUSE prompt>
*** glibc detected *** ./p1: munmap_chunk(): invalid pointer: 0x000000001db0ea60 ***


Root cause of the problem is in your file main.f90 line #29
call add(i,j, N)
where N was changed to N = i + j

However, MatrixMaltiply needs argument N to be equal to 2 according to A,B,C allocations

Damn! I didn't notice that. I had meant to comment out the call to add(i,j,N)". Stupid mistake. Thanks for pointing it out. It works now.
Reply