Align memory allocation in PUGH

Create issue
Issue #1411 closed
Roland Haas created an issue

the attached patch optionally uses thorn vectors to query the vector size and aligns memory allocation to this size. This is needed for aligned reads and writes generated eg by Kranc generated thorns when Vectors is present.

Without the thorn present at build time, no alignment is performed. Failure to align results in segmentation faults at runtime.

Keyword: PUGH

Comments (11)

  1. Roland Haas reporter
    • changed status to open
    • removed comment

    Tested on my workstation (core i7 uses avx and a vector size of 4) and on queenbee. The C++ code is only present since vectors.h contains C++ code (namespace access).

  2. Ian Hinder
    • removed comment

    Something (Vectors?) should check whether the memory is aligned and give a sensible error message if it should be and isn't.

  3. Erik Schnetter
    • removed comment

    For this to work, something else (PUGH?) needs to specify whether it provides memory that is aligned.

    Currently, only the thorn using vectors have the full information, and could check the addresses of the grid functions it accesses for vector load/store operations.

  4. Roland Haas reporter
    • removed comment

    Was missing a file (, which I just added (rev 525). Comes from trying to be extra careful and applying precisely the patch that was in the ET trac systems and rather than the previously set up subversion state :-(. Is there a way to do a "svn patch <somepatch.patch" so that subversion learns about new files in a patch.

  5. Frank Löffler
    • removed comment


    svn patch FILE

    From the documentation:

    svn patch will apply unidiff changes to existing files just like third party patch tools. It will also add newly created files to version control, and delete files and directories which are left empty after patching.

    Requires svn version 1.7 though...

  6. Roland Haas reporter
    • removed comment

    Alright. This ticket was even still open. I also misspelled vectors.h as Vectors.h in the C++ file. This only ever compiled because of an OPTIONAL_IFACTIVE Vectors in configuration.ccl. Question: if all I need of Vectors is its include file (and its CCTK_VECLENGTH define) but do not actually call any function in Vectors (ie pure compile time usage of Vectors), do I still need to REQUIRE (or equivalent) the thorn at runtime? If not then the OPTIONAL_IFACTIVE can be removed.

  7. Log in to comment