adjust NTH in samples/pdegen

dev-openmp
sfilippone 2 years ago
parent 494b8b925f
commit 3a5e73e4c8

@ -73,6 +73,9 @@ program amg_d_pde2d
use amg_d_pde2d_exp_mod use amg_d_pde2d_exp_mod
use amg_d_pde2d_box_mod use amg_d_pde2d_box_mod
use amg_d_genpde_mod use amg_d_genpde_mod
#if defined(OPENMP)
use omp_lib
#endif
implicit none implicit none
! input parameters ! input parameters
@ -93,7 +96,7 @@ program amg_d_pde2d
type(psb_d_vect_type) :: x,b,r type(psb_d_vect_type) :: x,b,r
! parallel environment ! parallel environment
type(psb_ctxt_type) :: ctxt type(psb_ctxt_type) :: ctxt
integer(psb_ipk_) :: iam, np integer(psb_ipk_) :: iam, np, nth
! solver parameters ! solver parameters
integer(psb_ipk_) :: iter, itmax,itrace, istopc, irst, nlv integer(psb_ipk_) :: iter, itmax,itrace, istopc, irst, nlv
@ -197,6 +200,15 @@ program amg_d_pde2d
call psb_init(ctxt) call psb_init(ctxt)
call psb_info(ctxt,iam,np) call psb_info(ctxt,iam,np)
#if defined(OPENMP)
!$OMP parallel shared(nth)
!$OMP master
nth = omp_get_num_threads()
!$OMP end master
!$OMP end parallel
#else
nth = 1
#endif
if (iam < 0) then if (iam < 0) then
! This should not happen, but just in case ! This should not happen, but just in case
@ -451,7 +463,9 @@ program amg_d_pde2d
call psb_sum(ctxt,precsize) call psb_sum(ctxt,precsize)
call prec%descr(info,iout=psb_out_unit) call prec%descr(info,iout=psb_out_unit)
if (iam == psb_root_) then if (iam == psb_root_) then
write(psb_out_unit,'("Computed solution on ",i8," processors")') np write(psb_out_unit,'("Computed solution on ",i8," processors")') np
write(psb_out_unit,'("Number of threads : ",i12)') nth
write(psb_out_unit,'("Total number of tasks : ",i12)') nth*np
write(psb_out_unit,'("Linear system size : ",i12)') system_size write(psb_out_unit,'("Linear system size : ",i12)') system_size
write(psb_out_unit,'("PDE Coefficients : ",a)') trim(pdecoeff) write(psb_out_unit,'("PDE Coefficients : ",a)') trim(pdecoeff)
write(psb_out_unit,'("Krylov method : ",a)') trim(s_choice%kmethd) write(psb_out_unit,'("Krylov method : ",a)') trim(s_choice%kmethd)

@ -74,6 +74,9 @@ program amg_d_pde3d
use amg_d_pde3d_exp_mod use amg_d_pde3d_exp_mod
use amg_d_pde3d_gauss_mod use amg_d_pde3d_gauss_mod
use amg_d_genpde_mod use amg_d_genpde_mod
#if defined(OPENMP)
use omp_lib
#endif
implicit none implicit none
! input parameters ! input parameters
@ -94,7 +97,7 @@ program amg_d_pde3d
type(psb_d_vect_type) :: x,b,r type(psb_d_vect_type) :: x,b,r
! parallel environment ! parallel environment
type(psb_ctxt_type) :: ctxt type(psb_ctxt_type) :: ctxt
integer(psb_ipk_) :: iam, np integer(psb_ipk_) :: iam, np, nth
! solver parameters ! solver parameters
integer(psb_ipk_) :: iter, itmax,itrace, istopc, irst, nlv integer(psb_ipk_) :: iter, itmax,itrace, istopc, irst, nlv
@ -198,6 +201,15 @@ program amg_d_pde3d
call psb_init(ctxt) call psb_init(ctxt)
call psb_info(ctxt,iam,np) call psb_info(ctxt,iam,np)
#if defined(OPENMP)
!$OMP parallel shared(nth)
!$OMP master
nth = omp_get_num_threads()
!$OMP end master
!$OMP end parallel
#else
nth = 1
#endif
if (iam < 0) then if (iam < 0) then
! This should not happen, but just in case ! This should not happen, but just in case
@ -456,6 +468,8 @@ program amg_d_pde3d
call prec%descr(info,iout=psb_out_unit) call prec%descr(info,iout=psb_out_unit)
if (iam == psb_root_) then if (iam == psb_root_) then
write(psb_out_unit,'("Computed solution on ",i8," processors")') np write(psb_out_unit,'("Computed solution on ",i8," processors")') np
write(psb_out_unit,'("Number of threads : ",i12)') nth
write(psb_out_unit,'("Total number of tasks : ",i12)') nth*np
write(psb_out_unit,'("Linear system size : ",i12)') system_size write(psb_out_unit,'("Linear system size : ",i12)') system_size
write(psb_out_unit,'("PDE Coefficients : ",a)') trim(pdecoeff) write(psb_out_unit,'("PDE Coefficients : ",a)') trim(pdecoeff)
write(psb_out_unit,'("Krylov method : ",a)') trim(s_choice%kmethd) write(psb_out_unit,'("Krylov method : ",a)') trim(s_choice%kmethd)

@ -73,6 +73,9 @@ program amg_s_pde2d
use amg_s_pde2d_exp_mod use amg_s_pde2d_exp_mod
use amg_s_pde2d_box_mod use amg_s_pde2d_box_mod
use amg_s_genpde_mod use amg_s_genpde_mod
#if defined(OPENMP)
use omp_lib
#endif
implicit none implicit none
! input parameters ! input parameters
@ -93,7 +96,7 @@ program amg_s_pde2d
type(psb_s_vect_type) :: x,b,r type(psb_s_vect_type) :: x,b,r
! parallel environment ! parallel environment
type(psb_ctxt_type) :: ctxt type(psb_ctxt_type) :: ctxt
integer(psb_ipk_) :: iam, np integer(psb_ipk_) :: iam, np, nth
! solver parameters ! solver parameters
integer(psb_ipk_) :: iter, itmax,itrace, istopc, irst, nlv integer(psb_ipk_) :: iter, itmax,itrace, istopc, irst, nlv
@ -197,6 +200,15 @@ program amg_s_pde2d
call psb_init(ctxt) call psb_init(ctxt)
call psb_info(ctxt,iam,np) call psb_info(ctxt,iam,np)
#if defined(OPENMP)
!$OMP parallel shared(nth)
!$OMP master
nth = omp_get_num_threads()
!$OMP end master
!$OMP end parallel
#else
nth = 1
#endif
if (iam < 0) then if (iam < 0) then
! This should not happen, but just in case ! This should not happen, but just in case
@ -451,7 +463,9 @@ program amg_s_pde2d
call psb_sum(ctxt,precsize) call psb_sum(ctxt,precsize)
call prec%descr(info,iout=psb_out_unit) call prec%descr(info,iout=psb_out_unit)
if (iam == psb_root_) then if (iam == psb_root_) then
write(psb_out_unit,'("Computed solution on ",i8," processors")') np write(psb_out_unit,'("Computed solution on ",i8," processors")') np
write(psb_out_unit,'("Number of threads : ",i12)') nth
write(psb_out_unit,'("Total number of tasks : ",i12)') nth*np
write(psb_out_unit,'("Linear system size : ",i12)') system_size write(psb_out_unit,'("Linear system size : ",i12)') system_size
write(psb_out_unit,'("PDE Coefficients : ",a)') trim(pdecoeff) write(psb_out_unit,'("PDE Coefficients : ",a)') trim(pdecoeff)
write(psb_out_unit,'("Krylov method : ",a)') trim(s_choice%kmethd) write(psb_out_unit,'("Krylov method : ",a)') trim(s_choice%kmethd)

@ -74,6 +74,9 @@ program amg_s_pde3d
use amg_s_pde3d_exp_mod use amg_s_pde3d_exp_mod
use amg_s_pde3d_gauss_mod use amg_s_pde3d_gauss_mod
use amg_s_genpde_mod use amg_s_genpde_mod
#if defined(OPENMP)
use omp_lib
#endif
implicit none implicit none
! input parameters ! input parameters
@ -94,7 +97,7 @@ program amg_s_pde3d
type(psb_s_vect_type) :: x,b,r type(psb_s_vect_type) :: x,b,r
! parallel environment ! parallel environment
type(psb_ctxt_type) :: ctxt type(psb_ctxt_type) :: ctxt
integer(psb_ipk_) :: iam, np integer(psb_ipk_) :: iam, np, nth
! solver parameters ! solver parameters
integer(psb_ipk_) :: iter, itmax,itrace, istopc, irst, nlv integer(psb_ipk_) :: iter, itmax,itrace, istopc, irst, nlv
@ -198,6 +201,15 @@ program amg_s_pde3d
call psb_init(ctxt) call psb_init(ctxt)
call psb_info(ctxt,iam,np) call psb_info(ctxt,iam,np)
#if defined(OPENMP)
!$OMP parallel shared(nth)
!$OMP master
nth = omp_get_num_threads()
!$OMP end master
!$OMP end parallel
#else
nth = 1
#endif
if (iam < 0) then if (iam < 0) then
! This should not happen, but just in case ! This should not happen, but just in case
@ -456,6 +468,8 @@ program amg_s_pde3d
call prec%descr(info,iout=psb_out_unit) call prec%descr(info,iout=psb_out_unit)
if (iam == psb_root_) then if (iam == psb_root_) then
write(psb_out_unit,'("Computed solution on ",i8," processors")') np write(psb_out_unit,'("Computed solution on ",i8," processors")') np
write(psb_out_unit,'("Number of threads : ",i12)') nth
write(psb_out_unit,'("Total number of tasks : ",i12)') nth*np
write(psb_out_unit,'("Linear system size : ",i12)') system_size write(psb_out_unit,'("Linear system size : ",i12)') system_size
write(psb_out_unit,'("PDE Coefficients : ",a)') trim(pdecoeff) write(psb_out_unit,'("PDE Coefficients : ",a)') trim(pdecoeff)
write(psb_out_unit,'("Krylov method : ",a)') trim(s_choice%kmethd) write(psb_out_unit,'("Krylov method : ",a)') trim(s_choice%kmethd)
Loading…
Cancel
Save