

Note that the call to foo is needed else the compiler will optimize away the outer iteration loop.
#Simply fortran write to console code#
Now, if I change your code so these loops are executed 10,000 times, the overhead gets amortized across multiple invocations and we begin to see speed-up. Also, a performing a parallel reduction requires a partial reduction step followed by a second kernel launch to perform the final reduction. Accelerator code does have some overhead in launching kernels, initializing the device, and copying data to the device.

This means time using parallel acc loops is longer than using cpu to do loops! So, this means time using parallel acc loops is longer than using cpu to do loops!ĭoes that make sense to you? I think I am doing something wrong here. Output when execute the code: → (without using !$acc before do loops) Output when execute the code: → (using !$acc before do loops) Still can use “use openacc”, don’t know why. = Rebuild All: 1 succeeded, 0 failed, 0 skipped = Rebuild All started: Project: OpenACC1, Configuration: Release 圆4 -ĭeleting intermediate and output files for project ‘OpenACC1’, configuration ‘Release’Ģ6, !$acc loop gang, vector(8) ! blockidx%x threadidx%xĢ7, !$acc loop gang, vector(8) ! blockidx%y threadidx%yĬC 1.0 : 8 registers 304 shared, 32 constant, 0 local memory bytes 66% occupancyĬC 2.0 : 10 registers 264 shared, 64 constant, 0 local memory bytes 33% occupancyīuild log was saved at “file://D:\Cuda Dev\OpenACC1\圆4\Release\BuildLog.htm” The output after I compile: ( no “use openacc”) Write( ,10) 'PROGRAM STARTED AT: ', START_TIME(5), START_TIME(6),& The optimist believes we live in the best of all possible worlds - the pessimist fears this might be true.Integer, allocatable, dimension (:,:) :: AĬALL DATE_AND_TIME (REAL_CLOCK (1), REAL_CLOCK (2),& In the days of old I was one of those that occasionally created a lot of nearly empty printout. The 'use dfwin' - statement is present only for the sleep function to work, you would not need both in real life.īut I am quite happy that this carriage control does not work any more unless you express your wish to do so explicitly.

That is what apparently happens in the open-statement. Write(6,'(a1, a10, i3)')'+','values are ', i ! write to consoleĬall sleep (100) ! wait some time to see the outputĪs far as I understand it, you have to specify that the console handles the first character of an output record as in the days of old, taking it for a carriage control character. Open (unit = 6, file = 'CON', carriagecontrol = 'fortran') Use dfwin ! win 32 API routine definitions
