- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm trying to perform matrix multiplication using Intel Fortran Compiler (ifort) with OpenMP and MKL's DGEMM routine. The code divides matrices into blocks and uses OpenMP for parallel execution. However, I encounter a "Segmentation fault (core dumped)" error when running the program.
compilation command: ifort -qopenmp -qmkl=sequential matmul.f90
Here’s a simplified version of my code:
integer, parameter :: n = 9 ! Number of rows and columns of matrix integer, parameter :: nt = 3 ! Sq root of number of threads real(8), dimension(n,n) :: A, B, C integer :: nb ! Block size integer :: bi(nt,2) ! Start and End indices of block matrices integer :: i, j, k integer :: starttime, endtime, countrate call omp_set_num_threads(nt*nt) print*, "Number of OMP Threads", nt*nt call random_number(A) call random_number(B) if (mod(n,nt) == 0) then nb = n/nt else nb = n/nt + 1 end if !print*, "block size", nb do i = 1, nt bi(i,1) = 1 + nb*(i-1) bi(i,2) = min(nb*i,n) end do call system_clock(starttime, countrate) !$OMP PARALLEL DO COLLAPSE(2) do i = 1, nt do j = 1, nt call DGEMM('N', 'N', n, n, n, 1.0d0, A(bi(i,1):bi(i,2), :), n, & B(:, bi(j,1):bi(j,2)), n, 0.0d0, & C(bi(i,1):bi(i,2), bi(j,1):bi(j,2)), n) end do end do !$OMP END PARALLEL DO call system_clock(endtime)
Link Copied
0 Replies

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page