Skip to content

Commit

Permalink
[cmsdy] in dsample.f of pp_dy3j.mad P0_gux_taptamggux (also copied to…
Browse files Browse the repository at this point in the history
… gg_tt.mad), skip xbin checks if CUDACPP_RUNTIME_SKIPXBINCHECKS is set (part3 of madgraph5#969)

This is a very large improvement, but it may be more controversial, hence it is disabled by default...

CUDACPP_RUNTIME_DISABLEFPE=1 ./build.cuda_d_inl0_hrd0/madevent_cuda < /tmp/avalassi/input_dy3j_x1_cudacpp
 [COUNTERS] PROGRAM TOTAL                         :    4.1142s
 [COUNTERS] Fortran Other                  (  0 ) :    0.1610s
 [COUNTERS] Fortran Initialise(I/O)        (  1 ) :    0.0670s
 [COUNTERS] Fortran Random2Momenta         (  3 ) :    2.8821s for  1170103 events => throughput is 2.46E-06 events/s
 [COUNTERS] Fortran PDFs                   (  4 ) :    0.0962s for    49152 events => throughput is 1.96E-06 events/s
 [COUNTERS] Fortran UpdateScaleCouplings   (  5 ) :    0.1278s for    16384 events => throughput is 7.80E-06 events/s
 [COUNTERS] Fortran Reweight               (  6 ) :    0.0485s for    16384 events => throughput is 2.96E-06 events/s
 [COUNTERS] Fortran Unweight(LHE-I/O)      (  7 ) :    0.0670s for    16384 events => throughput is 4.09E-06 events/s
 [COUNTERS] Fortran SamplePutPoint         (  8 ) :    0.1355s for  1170103 events => throughput is 1.16E-07 events/s
 [COUNTERS] CudaCpp Initialise             ( 11 ) :    0.4683s
 [COUNTERS] CudaCpp Finalise               ( 12 ) :    0.0262s
 [COUNTERS] CudaCpp MEs                    ( 19 ) :    0.0348s for    16384 events => throughput is 2.13E-06 events/s
 [COUNTERS] OVERALL NON-MEs                ( 21 ) :    4.0794s
 [COUNTERS] OVERALL MEs                    ( 22 ) :    0.0348s for    16384 events => throughput is 2.13E-06 events/s

CUDACPP_RUNTIME_SKIPXBINCHECKS=1 CUDACPP_RUNTIME_DISABLEFPE=1 ./build.cuda_d_inl0_hrd0/madevent_cuda < /tmp/avalassi/input_dy3j_x1_cudacpp
 [COUNTERS] PROGRAM TOTAL                         :    3.2969s
 [COUNTERS] Fortran Other                  (  0 ) :    0.1726s
 [COUNTERS] Fortran Initialise(I/O)        (  1 ) :    0.0674s
 [COUNTERS] Fortran Random2Momenta         (  3 ) :    2.0464s for  1170103 events => throughput is 1.75E-06 events/s
 [COUNTERS] Fortran PDFs                   (  4 ) :    0.0958s for    49152 events => throughput is 1.95E-06 events/s
 [COUNTERS] Fortran UpdateScaleCouplings   (  5 ) :    0.1298s for    16384 events => throughput is 7.92E-06 events/s
 [COUNTERS] Fortran Reweight               (  6 ) :    0.0482s for    16384 events => throughput is 2.94E-06 events/s
 [COUNTERS] Fortran Unweight(LHE-I/O)      (  7 ) :    0.0656s for    16384 events => throughput is 4.00E-06 events/s
 [COUNTERS] Fortran SamplePutPoint         (  8 ) :    0.1412s for  1170103 events => throughput is 1.21E-07 events/s
 [COUNTERS] CudaCpp Initialise             ( 11 ) :    0.4685s
 [COUNTERS] CudaCpp Finalise               ( 12 ) :    0.0266s
 [COUNTERS] CudaCpp MEs                    ( 19 ) :    0.0349s for    16384 events => throughput is 2.13E-06 events/s
 [COUNTERS] OVERALL NON-MEs                ( 21 ) :    3.2620s
 [COUNTERS] OVERALL MEs                    ( 22 ) :    0.0349s for    16384 events => throughput is 2.13E-06 events/s
  • Loading branch information
valassi committed Aug 19, 2024
1 parent 5e9000f commit ff0d7d6
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion epochX/cudacpp/pp_dy3j.mad/Source/dsample.f
Original file line number Diff line number Diff line change
Expand Up @@ -1264,6 +1264,12 @@ subroutine sample_get_x(wgt, x, j, ipole, xmin, xmax)
save xbin_min0_saved, xbin_max1_saved
data xbin_min0_saved/xbinarraydim*.false./
data xbin_max1_saved/xbinarraydim*.false./

character*255 env_name, env_value
integer env_length, env_status
logical first, skipxbinchecks
data first, skipxbinchecks/.true., .false./
save first, skipxbinchecks
c
c External
c
Expand Down Expand Up @@ -1415,7 +1421,19 @@ subroutine sample_get_x(wgt, x, j, ipole, xmin, xmax)
c double precision is about 18 digits, we expect things to agree to
c 3 digit accuracy.
c
if (abs(ddum(j)-xbin(x,ij))/(ddum(j)+1d-22) .gt. 1e-3) then
if (first) then
env_name = 'CUDACPP_RUNTIME_SKIPXBINCHECKS'
call get_environment_variable(env_name, env_value, env_length, env_status)
if( env_status.eq.0 ) then
skipxbinchecks = .true.
endif
endif

if (skipxbinchecks) then
if (first) then
write(6,*) 'WARNING: skipping xbin checks (CUDACPP_RUNTIME_SKIPXBINCHECKS is set)'
endif
else if (abs(ddum(j)-xbin(x,ij))/(ddum(j)+1d-22) .gt. 1e-3) then
if (icount .lt. 5) then
write(*,'(a,i4,2e14.6,1e12.4)')
& 'Warning xbin not returning correct x', ij,
Expand All @@ -1426,6 +1444,7 @@ subroutine sample_get_x(wgt, x, j, ipole, xmin, xmax)
endif
icount=icount+1
endif
first = .false.
c if (x .lt. xmin .or. x .gt. xmax) then
c write(*,'(a,4i4,2f24.16,1e10.2)') 'Bad x',ij,int(xbin_min),ip,
c & int(xbin_max),xmin,x,xmax-xmin
Expand Down

0 comments on commit ff0d7d6

Please sign in to comment.