Commit 185aa87b authored by Andreas Marek's avatar Andreas Marek
Browse files

Error in write statements

parent 6443b37d
......@@ -2,7 +2,7 @@
! module for producing matrix traces, to be plotted by provided python ploter
! currently the module is very simple and non-flexible
! it is only ussable for printing the matrix A and possibly its counterpart A_DEV
! it is only ussable for printing the matrix A and possibly its counterpart A_DEV
! both are assumed to be in block-cyclic distribution
! At the moment, the output works for double real only
! To simplify thihngs, a conveninece macro (as follows) can be placed to .X90 template file:
......@@ -10,7 +10,7 @@
! #undef SAVE_MATR
! #ifdef DOUBLE_PRECISION_REAL
! #define SAVE_MATR(name, iteration) \
! call prmat(na,useGpu,a_mat,a_dev,lda,matrixCols,nblk,my_prow,my_pcol,np_rows,np_cols,name,iteration)
! call prmat(na,useGpu,a_mat,a_dev,lda,matrixCols,nblk,my_prow,my_pcol,np_rows,np_cols,name,iteration)
! #else
! #define SAVE_MATR(name, iteration)
! #endif
......@@ -20,7 +20,7 @@
module matrix_plot
contains
subroutine prmat(na, useGpu, a_mat, a_dev, lda, matrixCols, nblk, my_prow, my_pcol, np_rows, np_cols, name, iteration)
use cuda_functions
use iso_c_binding
......@@ -29,7 +29,7 @@ module matrix_plot
integer, parameter :: out_unit=20
character(len = 1025) :: directory = "matrices"
character(len = 1024) :: filename
character(len = *), intent(in) :: name
integer(kind=ik), intent(in) :: na, lda, nblk, matrixCols, my_prow, my_pcol, np_rows, np_cols, iteration
real(kind=REAL_DATATYPE), intent(in) :: a_mat(lda,matrixCols)
......@@ -41,40 +41,40 @@ module matrix_plot
real(kind=REAL_DATATYPE) :: a_dev_helper(lda,matrixCols)
logical :: successCUDA
integer(kind=c_size_t), parameter :: size_of_datatype = size_of_double_real
mpi_rank = np_rows * my_pcol + my_prow
! print a_mat
write(filename, "(A,A,I0.4,A,I0.2,A)"), trim(directory), "/a_mat-", counter, "-", mpi_rank, ".txt"
write(*,*), trim(filename)
write(filename, "(A,A,I0.4,A,I0.2,A)") trim(directory), "/a_mat-", counter, "-", mpi_rank, ".txt"
write(*,*) trim(filename)
open(unit=out_unit, file=trim(filename), action="write",status="replace")
write(out_unit, "(9I5)") na, nblk, lda, matrixCols, my_prow, my_pcol, np_rows, np_cols, iteration
write(out_unit, "(A)") name
do row = 1, lda
write(out_unit, *) a_mat(row, :)
end do
close(out_unit)
close(out_unit)
! print a_dev
if(useGpu) then
successCUDA = cuda_memcpy(loc(a_dev_helper(1,1)), a_dev, lda * matrixCols * size_of_datatype, cudaMemcpyDeviceToHost)
write(filename, "(A,A,I0.4,A,I0.2,A)"), trim(directory), "/a_dev-", counter, "-", mpi_rank, ".txt"
write(*,*), trim(filename)
write(filename, "(A,A,I0.4,A,I0.2,A)") trim(directory), "/a_dev-", counter, "-", mpi_rank, ".txt"
write(*,*) trim(filename)
open(unit=out_unit, file=trim(filename), action="write",status="replace")
write(out_unit, "(9I5)") na, nblk, lda, matrixCols, my_prow, my_pcol, np_rows, np_cols, iteration
write(out_unit, "(A)") name
do row = 1, lda
write(out_unit, *) a_dev_helper(row, :)
end do
close(out_unit)
close(out_unit)
end if
counter = counter + 1
end subroutine
end module
\ No newline at end of file
end module
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment