Commit f8f2c3db authored by Serhiy Mochalskyy's avatar Serhiy Mochalskyy

Binari file with text and double

parent 47315fc7
......@@ -3,7 +3,7 @@ module sca
implicit none
integer :: MYPNUM,NPROCS,CONTEXT,NPROW,NPCOL,MYCOL,MYROW,NB,MP_A,NQ_A,LDA_A
integer :: MYPNUM,NPROCS,CONTEXT,NPROW,NPCOL,MYCOL,MYROW,NB,LDA_A!, MP_A,NQ_A
integer :: ipc,ipr
integer :: LDA_wp,LDA_pwe, LDA_pp,LDA_ep,LDA_ew, LDA_pwe_s,&
LDA_we,LDA_ee,LDA_ww,LDA_rw,LDA_sww, LDA_s_ww_inv
......@@ -14,6 +14,8 @@ module sca
real :: ORFAC
integer :: lwork_cooficient
real, dimension(:),allocatable :: WORK
end module sca
......@@ -45,8 +47,8 @@ implicit none
integer(kind=MPI_OFFSET_KIND) :: disp
integer size,counter
integer, dimension(2) :: pdims, dims, distribs, dargs
integer :: my_darray
integer :: my_darray, size_mpi
integer NUMROC
EXTERNAL NUMROC
integer INDXL2G
......@@ -55,6 +57,11 @@ implicit none
integer thefile
integer,parameter :: k16 = selected_int_kind(16)
integer(kind=k16) :: loc_arr_size,MP_A, NQ_A
character(len=512) :: char512
!=====================================
......@@ -94,21 +101,21 @@ implicit none
CALL BLACS_GRIDINFO (CONTEXT, NPROW, NPCOL, MYROW, MYCOL)
size=150000
size=9
n_matrix_row=size
n_matrix_col=size
!allocate(Arr(n_matrix_row,n_matrix_col),arr_glo_print(n_matrix_row,n_matrix_col),stat=ier)
!IF (IER /= 0) THEN
! WRITE (*,*) "global matrix can not allocate"
! STOP
! END IF
allocate(Arr(n_matrix_row,n_matrix_col),arr_glo_print(n_matrix_row,n_matrix_col),stat=ier)
IF (IER /= 0) THEN
WRITE (*,*) "global matrix can not allocate"
STOP
END IF
! do i=1,n_matrix_row
! do j=1, n_matrix_col
! Arr(i,j)=i*10.0+j
! enddo
! enddo
do i=1,n_matrix_row
do j=1, n_matrix_col
Arr(i,j)=i*10.0+j
enddo
enddo
! if(rank==0) then
......@@ -127,7 +134,7 @@ implicit none
! write(*,*) Arr(:,:)
NB=64
NB=2
MP_A=NUMROC(n_matrix_row, NB, MYROW, 0, NPROW)
NQ_A=NUMROC(n_matrix_col, NB, MYCOL, 0, NPCOL)
......@@ -144,25 +151,25 @@ implicit none
! write(*,*) rank, " ",MP_A, NQ_A
!do i=1,size
! do j=1, size
! call ScaLAPACK_mapping_i(i,i_loc,inside_i)
! if (inside_i) then
! call ScaLAPACK_mapping_j(j,j_loc,inside_j)
! if (inside_j) then
! arr_loc(i_loc,j_loc)=Arr(i,j)
! endif
! endif
! enddo
!enddo
do i=1,MP_A
do j=1, NQ_A
Arr_loc(i,j)=rank+0.1123+i+j
do i=1,size
do j=1, size
call ScaLAPACK_mapping_i(i,i_loc,inside_i)
if (inside_i) then
call ScaLAPACK_mapping_j(j,j_loc,inside_j)
if (inside_j) then
arr_loc(i_loc,j_loc)=Arr(i,j)
endif
endif
enddo
enddo
! do i=1,MP_A
! do j=1, NQ_A
! Arr_loc(i,j)=rank+0.1123+i+j
! enddo
! enddo
! do i=1,MP_A
! do j=1, NQ_A
......@@ -206,6 +213,25 @@ implicit none
!===========================================================================
char512='#@content STARWALL'
if(rank==0) then
write(6,*) Arr(:,:)
open(80, file='my_file.dat', form="unformatted",access='stream', status='replace',action='write')
! char512='#@content STARWALL VACUUM RESPONSE DATA FOR THE JOREK CODE'
! write(60) 42, 42.d0 !### for an elementary check in JOREK
write(80) trim(char512)
write(80) Arr(:,:)
close(80)
endif
......@@ -213,11 +239,29 @@ dims=[size, size]
distribs = [MPI_DISTRIBUTE_CYCLIC, MPI_DISTRIBUTE_CYCLIC]
dargs = [nb, nb]
pdims = [NPROW, NPCOL]
loc_arr_size=MP_A*NQ_A
!call MPI_Type_create_darray(procs, mpirank, 2, dims, distribs, dargs,pdims, MPI_ORDER_FORTRAN, MPI_REAL, darray,ierr)
char512='#@content STARWALL'
!write(6,*) rank, len_trim(char512)
!write(6,*) rank, sizeof(trim(char512))
!write(6,*) rank, sizeof(size)
call MPI_TYPE_SIZE(MPI_CHARACTER, size_mpi,ier)
if (rank==0) write(6,*) "size_mpi=",size_mpi
disp=0
time1=MPI_WTIME()
call MPI_Type_create_darray(numtasks, rank, 2, dims, distribs, dargs, pdims,MPI_ORDER_FORTRAN, MPI_DOUBLE_PRECISION, my_darray, ierr)
call MPI_Type_commit(my_darray,ierr)
......@@ -227,15 +271,39 @@ call MPI_FILE_OPEN(MPI_COMM_WORLD, 'testfile2.txt', &
MPI_INFO_NULL, thefile, ier)
call MPI_BARRIER(MPI_COMM_WORLD, ier)
if(rank==0) call MPI_File_write(thefile, trim(char512) &
,sizeof(trim(char512)) , MPI_CHARACTER,status, ierr)
disp=0
!call MPI_FILE_CLOSE(thefile, ier)
!call MPI_FILE_OPEN(MPI_COMM_WORLD, 'testfile2.txt', &
! MPI_MODE_WRONLY + MPI_MODE_CREATE, &
! MPI_INFO_NULL, thefile, ier)
disp=disp+sizeof(trim(char512))
call MPI_File_set_view(thefile, disp, MPI_DOUBLE_PRECISION,my_darray, "native",MPI_INFO_NULL, ierr)
call MPI_File_write_all(thefile, arr_loc, MP_A*NQ_A, MPI_DOUBLE_PRECISION, status, ierr)
call MPI_File_write_all(thefile, arr_loc,loc_arr_size , MPI_DOUBLE_PRECISION, status, ierr)
disp=disp+SIZEOF(Arr_loc(1,1))*size*size
if (rank==0) write(6,*) "disp=",disp
call MPI_File_set_view(thefile, disp, MPI_DOUBLE_PRECISION,my_darray,"native",MPI_INFO_NULL, ierr)
call MPI_File_write_all(thefile, arr_loc,loc_arr_size , MPI_DOUBLE_PRECISION,status, ierr)
call MPI_BARRIER(MPI_COMM_WORLD, ier)
call MPI_FILE_CLOSE(thefile, ier)
!call MPI_TYPE_FREE(my_darray,ier)
time2=MPI_WTIME()
......
No preview for this file type
No preview for this file type
#!/bin/bash
#PBS -q xfuaprod
#PBS -l walltime=00:55:00
#PBS -l select=2:ncpus=36:mpiprocs=36:mem=100GB
#PBS -l walltime=00:20:00
#PBS -l select=5:ncpus=36:mpiprocs=36:mem=100GB
#PBS -j oe
#PBS -A FUSIO_HLST
#PBS -N MPI_IO
......
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