[cig-commits] [commit] devel, master: fix div by 0 bug: OpenCL gpu backend can't provide information about memory usage (e5ae7c2)

cig_noreply at geodynamics.org cig_noreply at geodynamics.org
Thu Nov 6 08:21:02 PST 2014


Repository : https://github.com/geodynamics/specfem3d_globe

On branches: devel,master
Link       : https://github.com/geodynamics/specfem3d_globe/compare/bc58e579b3b0838a0968725a076f5904845437ca...be63f20cbb6f462104e949894dbe205d2398cd7f

>---------------------------------------------------------------

commit e5ae7c24b0c6d6dd00b7a4f538204913508dae0a
Author: Kevin Pouget <kevin.pouget at imag.fr>
Date:   Wed Jun 4 15:19:42 2014 +0200

    fix div by 0 bug: OpenCL gpu backend can't provide information about memory usage


>---------------------------------------------------------------

e5ae7c24b0c6d6dd00b7a4f538204913508dae0a
 src/specfem3D/prepare_timerun.f90 | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/src/specfem3D/prepare_timerun.f90 b/src/specfem3D/prepare_timerun.f90
index 8009720..8c2dcc5 100644
--- a/src/specfem3D/prepare_timerun.f90
+++ b/src/specfem3D/prepare_timerun.f90
@@ -2205,12 +2205,19 @@
   if( myrank == 0 ) then
     ! gets memory usage for main process
     call get_free_device_memory(free_mb,used_mb,total_mb)
+
     ! outputs info
-    write(IMAIN,*)
-    write(IMAIN,*)"  GPU usage: free  =",free_mb," MB",nint(free_mb/total_mb*100.0),"%"
-    write(IMAIN,*)"             used  =",used_mb," MB",nint(used_mb/total_mb*100.0),"%"
-    write(IMAIN,*)"             total =",total_mb," MB",nint(total_mb/total_mb*100.0),"%"
-    write(IMAIN,*)
+    if (total_mb /= 0) then
+       write(IMAIN,*)
+       write(IMAIN,*)"  GPU usage: free  =",free_mb," MB",nint(free_mb/total_mb*100.0),"%"
+       write(IMAIN,*)"             used  =",used_mb," MB",nint(used_mb/total_mb*100.0),"%"
+       write(IMAIN,*)"             total =",total_mb," MB",nint(total_mb/total_mb*100.0),"%"
+       write(IMAIN,*)
+    else
+       write(IMAIN,*)
+       write(IMAIN,*)"  GPU usage: not available."
+    endif
+    
     call flush_IMAIN()
   endif
 



More information about the CIG-COMMITS mailing list