Skip to content

Check if Sapporo 2 works with GPUs #1209

Open
0 of 1 issue completed
Open

Description

@HannoSpreeuw

Does Sapporo 2 work with NVIDIA GPUs

Activity

  1. HannoSpreeuw commented on Mar 16, 2026

    @HannoSpreeuw
    CollaboratorAuthor

    I managed to build Sapporo 2 as "included" in AMUSE with CUDA release 13.1, with a few changes that have to do with newer CUDA versions.

    @rieder I could file a MR to https://github.com/treecode/sapporo2 with those updates.
    After the merge a Sapporo 2 build within AMUSE should be as simple as

    cd lib/sapporo_2
    python download.py
    cd src/sapporo2-master/lib/
    make
    

    The build is successful

    ar: creating libsapporo.a
    a - sapporohostclass.o
    a - interfaces/sapporoG6lib.o
    a - interfaces/sapporoYeblib.o
    a - interfaces/sapporoG5lib.o
    

    but yields a ton of warnings such as

    ./include/cudadev.h:357:45: warning: dereferencing type-punned pointer might 
    break strict-aliasing rules [-Wstrict-aliasing]
    

    and

    ./include/sapdevclass.h:103:19: warning: 'double4' is deprecated: 
    use double4_16a or double4_32a [-Wdeprecated-declarations]
    
  2. HannoSpreeuw commented on Mar 16, 2026

    @HannoSpreeuw
    CollaboratorAuthor

    I guess I will need to try running as well.

  3. LourensVeen commented on Mar 16, 2026

    @LourensVeen
    Member

    I think /lib/sapporo2 still needs to be integrated in the new build system; I guess that's a job for me.

    And then we need to figure out whether the codes work with Sapporo 2. I think there's one that requires Sapporo 2 and doesn't work with Sapporo light, but I don't remember which.

  4. HannoSpreeuw commented on Mar 16, 2026

    @HannoSpreeuw
    CollaboratorAuthor

    I'd be happy with a Python script that works for both Sapporo Light and Sapporo 2, with some switch.

    I guess that switch requires a manual modification of the Makefile that steers ./setup install amuse-ph4-sapporo.

  5. LourensVeen commented on Mar 16, 2026

    @LourensVeen
    Member

    Actually, maybe ./setup install sapporo2 and ./setup install amuse-ph4-sapporo and ./setup install amuse-ph4-sapporo2? That would be easiest to implement I think.

  6. HannoSpreeuw commented on Mar 16, 2026

    @HannoSpreeuw
    CollaboratorAuthor

    That would be easiest to implement I think.

    And which files would this implementation affect?

  7. LourensVeen commented on Mar 17, 2026

    @LourensVeen
    Member

    Off the top of my head, it would take a rewrite of lib/sapporo2/Makefile along the lines of lib/sapporo_light/Makefile and adding a support/ subdirectory there with an autoconf, and then probably an extra function in support/setup/installing.sh and maybe setup, and then an additional package definition in src/amuse_ph4/packages.

  8. HannoSpreeuw commented on Mar 17, 2026

    @HannoSpreeuw
    CollaboratorAuthor

    Wow, you rattled that off as if you do this every week.

  9. LourensVeen commented on May 12, 2026

    @LourensVeen
    Member

    I've looked at linking Ph4 with Sapporo2 instead of Sapporo Light, but that's failing because Sapporo2 doesn't have a g6_get_nj_max_() function. That's the one you added to give a better error message when the user wants more particles than Sapporo Light allows. So you need to look at Sapporo2, see if it has a particle limit too, and implement the same thing for this to work.

  10. HannoSpreeuw commented on May 12, 2026

    @HannoSpreeuw
    CollaboratorAuthor

    All right, I can do that.

  11. HannoSpreeuw commented on May 19, 2026

    @HannoSpreeuw
    CollaboratorAuthor

    Interestingly, in Sapporo 2 nj_max is set to a much smaller number than in Sapporo Light (131072):

        nj_max = 16384;    
    

    but there is some code to increase nj_max if address >= nj_max):

      if (address >= nj_max) {
        fprintf(stderr, "Increasing nj_max! Nj_max was: %d  to be stored address: %d \n",
                nj_max, address);
        increase_jMemory();
    
        //Extra check, if we are still outside nj_max, we quit since particles are not
        //nicely send in order
        if (address >= nj_max) {
          fprintf(stderr, "Increasing nj_max was not enough! Send particles in order to the library! Exit\n");
          exit(-1);
        }
      }
    

    However, increase_jMemory only gives a 10% increase.

  12. HannoSpreeuw commented on May 20, 2026

    @HannoSpreeuw
    CollaboratorAuthor

    Perhaps this does not matter with respect to solving the linking problem, I guess I'll need to add the same lines of code to Sapporo 2 as we added to Sapporo Light in closing #1208 through MR #1218 .

  13. HannoSpreeuw commented on May 28, 2026

    @HannoSpreeuw
    CollaboratorAuthor

    I've looked at linking Ph4 with Sapporo2 instead of Sapporo Light, but that's failing because Sapporo2 doesn't have a g6_get_nj_max_() function. That's the one you added to give a better error message when the user wants more particles than Sapporo Light allows. So you need to look at Sapporo2, see if it has a particle limit too, and implement the same thing for this to work.

    This should be addressed by Sapporo 2 MR 18.

  14. LourensVeen commented on May 28, 2026

    @LourensVeen
    Member

    Okay, I've added some commits to #1262 to add an amuse-ph4-sapporo2 package that compiles for me now with the updated Sapporo2 you made.

    ./setup test sapporo2 doesn't work yet, because it expects a make test command to work inside the Sapporo2 source, and that doesn't exist. But ./setup test ph4-sapporo2 should run the lone GPU test with Sapporo2. Could you give that a try on your test setup?

  15. moved this from Backlog to In progress in Development Boardon May 28, 2026
  16. HannoSpreeuw commented on May 28, 2026

    @HannoSpreeuw
    CollaboratorAuthor
    ./setup install amuse-ph4-sapporo2
    ./setup install sapporo2
    

    complete without (fatal) errors.

    ./setup test ph4-sapporo2
    

    yields

    Checking for dependencies, one moment please...
    
    Testing amuse-ph4-sapporo2...
    
    make: Entering directory '../amuse/src/amuse_ph4'
    cd packages/amuse-ph4-sapporo2 && pytest
    ============================= test session starts ==============================
    platform linux -- Python 3.14.5, pytest-9.0.3, pluggy-1.6.0
    rootdir: ../amuse/src/amuse_ph4/packages/amuse-ph4-sapporo2
    configfile: pyproject.toml
    testpaths: amuse_ph4/tests
    collected 35 items / 34 deselected / 1 selected
    
    amuse_ph4/tests/test_ph4.py s                                            [100%]
    
    ====================== 1 skipped, 34 deselected in 2.47s =======================
    make: Leaving directory '../amuse/src/amuse_ph4'
    
    **Package amuse-ph4-sapporo2 passed its tests.**
    

    ./setup test sapporo2 indeed yields

    Testing amuse-sapporo2...
    
    make: Entering directory '../amuse/lib/sapporo_2'
    make: *** No rule to make target 'test'.  Stop.
    make: Leaving directory '../amuse/lib/sapporo_2'
    
    sapporo2 failed its tests
    
  17. HannoSpreeuw commented on Jun 8, 2026

    @HannoSpreeuw
    CollaboratorAuthor

    Sapporo 2 PR20 should fix this, although a problem persists with running the OpenCL executables.

    I have spent some time trying to fix this, but I did not succeed. Since OpenCL is not used often in AMUSE, I propose to merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind: feature requestThe issue requests a feature that AMUSE does not currently have

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions