Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typo in the Lab2, Fortran, README.md #2

Open
AlexisEspinosaGayosso opened this issue May 5, 2021 · 0 comments
Open

Typo in the Lab2, Fortran, README.md #2

AlexisEspinosaGayosso opened this issue May 5, 2021 · 0 comments

Comments

@AlexisEspinosaGayosso
Copy link

AlexisEspinosaGayosso commented May 5, 2021

First Typo

In the block showing syntax for copying many arrays at once, you are using "c" syntax:

!$acc parallel loop copy(A[0:N], B[0:N])

while it should be

!$acc parallel loop copy(A(1,N), B(1,N))

Second Typo (together with a bug)

In the update section, you use twice:

!acc data copyin( A(n,m), Anew(n,m))

and once:

!acc update self(A(n,m))

While it should be:

!$acc data copyin( A(n,m), Anew(n,m))
.
.
.
!$acc update self(A(n,m))
Now the bug:

In your real code, you are allocating your arrays forcing indexing to start at (0,0) and end at (n-1,m-1). Therefore using the shape indicated above fails to cover the whole array (check your compiling -Minfo). Therefore, you may consider to use A(:,:), Anew(:,:) in your notes. (You are already using :,: in the real code.) Or, even better, modify your indexing in the creation of your arrays to comply with natural fortran indexing starting from (1,1).

Now a suggestion:

I suggest you to keep using the same size of Arrays as in the original example:

integer, parameter :: n=4096, m=4096, iter_max=1000

so that we can compare timings and performance.

And just print a partial size of the total array:

if(mod(iter,100).eq.0 ) then
   !$acc update self(A(:,:))
   write(*,'(i5,f10.6)'), iter, error
   write(*,*) '============='
   do i=1,10
      do j=1,10
         write(*,'(f10.2)', advance="no"), A(i,j)
      enddo
   enddo
   write(*,*) '============='
end if
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant