Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop' into cleanup-part1
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasm91 committed Oct 24, 2024
2 parents c9d0e9b + 374e0c0 commit 175e17c
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 21 deletions.
51 changes: 32 additions & 19 deletions src/programs/ectrans-benchmark.F90
Original file line number Diff line number Diff line change
Expand Up @@ -210,13 +210,16 @@ program ectrans_benchmark

integer(kind=jpim) :: ierr

real(kind=jprb), allocatable :: global_field(:,:)

!===================================================================================================

#include "setup_trans0.h"
#include "setup_trans.h"
#include "inv_trans.h"
#include "dir_trans.h"
#include "trans_inq.h"
#include "gath_grid.h"
#include "specnorm.h"
#include "abor1.intfb.h"
#include "gstats_setup.intfb.h"
Expand Down Expand Up @@ -576,7 +579,7 @@ program ectrans_benchmark
if (verbosity >= 0 .and. myproc == 1) then
write(nout,'(" ")')
write(nout,'(a,i0,a,f9.2,a)') "ectrans_benchmark initialisation, on ",nproc,&
& " tasks, took",ztinit," sec"
& " tasks, took ",ztinit," sec"
write(nout,'(" ")')
endif

Expand Down Expand Up @@ -652,12 +655,17 @@ program ectrans_benchmark
! While in grid point space, dump the values to disk, for debugging only
!=================================================================================================

if (ldump_values) then
! dump a field to a binary file
call dump_gridpoint_field(jstep, myproc, nproma, ngpblks, zgp2(:,1,:), 'S', noutdump)
call dump_gridpoint_field(jstep, myproc, nproma, ngpblks, zgpuv(:,nflevg,1,:), 'U', noutdump)
call dump_gridpoint_field(jstep, myproc, nproma, ngpblks, zgpuv(:,nflevg,2,:), 'V', noutdump)
call dump_gridpoint_field(jstep, myproc, nproma, ngpblks, zgp3a(:,nflevg,1,:), 'T', noutdump)
if (ldump_values .and. mod(jstep,10) == 1) then
if (myproc == 1) then
allocate(global_field(ngptotg,1))
endif
call dump_gridpoint_field(jstep, myproc, nproma, global_field, zgp2(:,1:1,:), 's', noutdump)
call dump_gridpoint_field(jstep, myproc, nproma, global_field, zgpuv(:,nflevg:nflevg,1,:), 'u', noutdump)
call dump_gridpoint_field(jstep, myproc, nproma, global_field, zgpuv(:,nflevg:nflevg,2,:), 'v', noutdump)
call dump_gridpoint_field(jstep, myproc, nproma, global_field, zgp3a(:,nflevg:nflevg,1,:), 't', noutdump)
if (myproc == 1) then
deallocate(global_field)
endif
endif

!=================================================================================================
Expand Down Expand Up @@ -1087,7 +1095,7 @@ subroutine get_command_line_arguments(nsmax, cgrid, iters, iters_warmup, nfld, n
character(len=128) :: carg ! Storage variable for command line arguments
integer :: iarg = 1 ! Argument index

#ifdef ACCGPU
#ifdef _OPENACC
!$acc init
#endif

Expand Down Expand Up @@ -1349,27 +1357,32 @@ end subroutine initialize_2d_spectral_field

!===================================================================================================

subroutine dump_gridpoint_field(jstep, myproc, nproma, ngpblks, fld, fldchar, noutdump)
subroutine dump_gridpoint_field(jstep, myproc, nproma, gfld, fld, fldchar, noutdump)

! Dump a 2d field to a binary file.

integer(kind=jpim), intent(in) :: jstep ! Time step, used for naming file
integer(kind=jpim), intent(in) :: myproc ! MPI rank, used for naming file
integer(kind=jpim), intent(in) :: nproma ! Size of nproma
integer(kind=jpim), intent(in) :: ngpblks ! Number of nproma blocks
real(kind=jprb) , intent(in) :: fld(nproma,ngpblks) ! 2D field
real(kind=jprb) , intent(inout) :: gfld(:,:) ! 2d global field
real(kind=jprb) , intent(in) :: fld(:,:,:) ! 3d local field
character , intent(in) :: fldchar ! Single character field identifier
integer(kind=jpim), intent(in) :: noutdump ! Tnit number for output file

character(len=14) :: filename = "x.xxx.xxxx.dat"

write(filename(1:1),'(a1)') fldchar
write(filename(3:5),'(i3.3)') jstep
write(filename(7:10),'(i4.4)') myproc
character(len=10) :: filename = "x.xxxx.dat"

open(noutdump, file=filename, form="unformatted")
write(noutdump) reshape(fld, (/ nproma*ngpblks /))
close(noutdump)
if (myproc == 1) then
write(filename(1:1),'(a1)') fldchar
write(filename(3:6),'(i4.4)') jstep
open(noutdump,file=filename,form='unformatted')
endif
do ilev=1,size(fld,2)
call gath_grid(gfld(:,:),nproma,1,(/1/),1,fld(:,ilev:ilev,:))
if (myproc == 1) write(unit=noutdump) gfld(:,1)
enddo
if (myproc == 1) then
close(noutdump)
endif

end subroutine dump_gridpoint_field

Expand Down
4 changes: 2 additions & 2 deletions src/trans/gpu/algor/hicblas_gemm.hip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ void hipblas_dgemm_wrapper(char transa, char transb, int m, int n, int k,
op_t2 = HIPBLAS_OP_T;

if (!hip_alreadyAllocated_dgemm_handle) {
hipblasCreate(&handle_hip_dgemm);
HICBLAS_CHECK(hipblasCreate(&handle_hip_dgemm));
hip_alreadyAllocated_dgemm_handle = true;
}
hipblasHandle_t handle = get_hipblas_handle();
Expand All @@ -299,7 +299,7 @@ void hipblas_sgemm_wrapper(char transa, char transb, int m, int n, int k,
op_t2 = HIPBLAS_OP_T;

if (!hip_alreadyAllocated_sgemm_handle) {
hipblasCreate(&handle_hip_sgemm);
HICBLAS_CHECK(hipblasCreate(&handle_hip_sgemm));
hip_alreadyAllocated_sgemm_handle = true;
}
HICBLAS_CHECK(hipblasSgemmStridedBatched(
Expand Down

0 comments on commit 175e17c

Please sign in to comment.