public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Tobias Burnus <tobias.burnus@physik.fu-berlin.de>
To: Daniel Carrera <dcarrera@gmail.com>,
	gcc-patches@gcc.gnu.org,	fortran@gcc.gnu.org
Subject: Re: [Patch, Fortra, Coarray] Free allocated memory for static	coarrays.
Date: Thu, 16 Jun 2011 12:55:00 -0000	[thread overview]
Message-ID: <20110616122153.GA31525@physik.fu-berlin.de> (raw)

Hi Daniel,

Daniel Carrera wrote:
> This patch adds a linked list to keep track of the allocated
> memory of all static coarrays and ensures that at the end of
> the program the memory is freed.

+_gfortran_caf_register (ptrdiff_t size,	caf_register_t type,
 			void **token)

Between "size," and "caf_register_t" is a <tab> instead of a simple " ".


 _gfortran_caf_init (int *argc, char ***argv, int *this_image, int *num_images)
[...]
+  if (this_image)
+    this_image = caf_this_image;
+  if (num_images)
+    num_images = caf_num_images;

As you mentioned yourself (in a private mail, commenting on my code):
There is a "*" missing at the left side of the assignment lines.


+_gfortran_caf_register (ptrdiff_t size, caf_register_t type,
                         void **token)
[...]
+  token = malloc (sizeof (void*) * caf_num_images);
+
+  /* Start MPI if not already started.  */
+  if (caf_num_images == 0)
+    _gfortran_caf_init (NULL, NULL, NULL, NULL);

Wrong order for the "token" allocation: You first need to know how many
images exists, before you can use "caf_num_images".


+  MPI_Allgather (local,    sizeof (void*), MPI_BYTE,

There is a <tab> character between "local," and "sizeof"; it should
have been a space.


Have you tested the modifications with MPI? I mean: Compiling mpi.c,
and then in gcc/testsuite/gfortran.dg/coarray:

for I in *.f90; do echo ====== $I =====; \
  mpif90 -fcoarray=lib $I mpi.o && mpiexec -np 3 ./a.out; done

Additionally, have you run test suite? It is sufficient to run recompile
gfortran (to create the latest libcaf_single.a from single.c) and then to
run
  make check-gfortran RUNTESTFLAGS="caf.exp"
(caf.exp is sufficient as the rest of the testsuite does not use
libgfortran/caf/single.c, which is the only thing your patch modifies.)


Otherwise, your patch looks OK.

Tobias,
who has currently no access to the GCC source code and can hence not
test himself.

             reply	other threads:[~2011-06-16 12:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-16 12:55 Tobias Burnus [this message]
2011-06-16 15:17 ` Daniel Carrera
2011-06-16 23:31   ` Tobias Burnus
  -- strict thread matches above, loose matches on Subject: below --
2011-06-16  9:45 Daniel Carrera

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110616122153.GA31525@physik.fu-berlin.de \
    --to=tobias.burnus@physik.fu-berlin.de \
    --cc=dcarrera@gmail.com \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).