[gmx-users] Compile Gromacs with OpenCL for MacBook Pro with AMD Radeon Pro 560 GPU

Szilárd Páll pall.szilard at gmail.com
Thu Feb 21 13:35:28 CET 2019


Michael,

That was my copy-paste mistake, I meant to suggest editing the following
file:
src/gromacs/gpu_utils/ocl_compiler.cpp

Please try this and run make check to see if it can now find included files.

--
Szilárd


On Tue, Feb 19, 2019 at 10:59 PM Michael Williams <
michael.r.c.williams at gmail.com> wrote:

> Hi Szilárd, thank you for the suggestion. I modified the file
> "src/gromacs/gpu_utils/gpu_utils_ocl.cpp” and replaced both instances of
> “#ifdef __APPLE__” with “#if 0”. I then checked that the build and
> regression tests worked without enabling the GPU support. All of the tests
> passed. Then, in a new build folder, I added -DGMX_GPU=ON and
> -DGMX_USE_OPENCL=ON to the Cmake instructions (see below). I did this
> separately for the unmodified version of GROMACS 2018.5 as well as inside a
> separate copy where I’d made the above changes. When I ran “make check” for
> both the unmodified and modified versions, I got the same error as before
> (logs pasted below). However, it seems to happen at different parts of the
> test suite: the unmodified version passed the MdrunTests, then failed on
> one of the MdrunMpiTests. The modified version of GROMACS failed during
> MdrunTests and then passed the MdrunMpiTests.
>
> During both runs of the tests I got a system popup asking if I wanted to
> allow the test executable that was running to accept incoming network
> connections. The window was only visible for a few seconds and I didn’t
> click either option (allow / deny) before the window went away again.
>
> Thanks again for your help, and if you have any other ideas I’d be quite
> willing to try them out and let you know the results.
>
>
> Mike
>
>
> Build settings on MacBook Pro (OSX 10.14.3, Mojave) using system clang and
> OpenMP library (from LLVM 7.0.1) built in custom path (no other parts of
> LLVM 7.0.1 are installed in this path):
>
> cmake ..
> -DCMAKE_INSTALL_PREFIX=/Users/michael/.local/apps/gromacs-2018.5-apple-clang-omp
> \
>                 -DCMAKE_PREFIX_PATH=/Users/michael/.local \
>                 -DCMAKE_C_COMPILER=/usr/bin/clang \
>                 -DCMAKE_CXX_COMPILER=/usr/bin/clang++ \
>                 -DCMAKE_C_FLAGS="-Wno-deprecated-declarations
> -Wno-unused-command-line-argument -Xpreprocessor -fopenmp -lomp
> -I/Users/michael/.local/include -L/Users/michael/.local/lib” \
>                 -DCMAKE_CXX_FLAGS="-Wno-deprecated-declarations
> -Wno-unused-command-line-argument -Xpreprocessor -fopenmp -lomp
> -I/Users/michael/.local/include -L/Users/michael/.local/lib” \
>                 -DGMX_FFT_LIBRARY=fftw3 \
>                 -DGMX_GPU=ON \
>                 -DGMX_USE_OPENCL=ON \
>
> -DREGRESSIONTEST_PATH=/Users/michael/.local/source/regressiontests-2018.5
>
> (Note: tabs added to make the above command easier to read)
>
>
> ***ERROR LOG WITH UNMODIFIED GPU_UTILS_OCL.CPP:
>
> Can not increase nstlist because an NVE ensemble is used
> Using 2 MPI threads
> Using 1 OpenMP thread per tMPI thread
>
> On host veronika.local 1 GPU auto-selected for this run.
> Mapping of GPU IDs to the 2 GPU tasks in the 2 ranks on this node:
>   PP:0,PP:0
>
> NOTE: Your choice of number of MPI ranks and amount of resources results
> in using 1 OpenMP threads per rank, which is most likely inefficient. The
> optimum is usually between 2 and 6 threads per rank.
> Compilation of source file
> /Users/michael/.local/source/gromacs-2018.5/src/gromacs/mdlib/nbnxn_ocl/
> nbnxn_ocl_kernels.cl failed!
> -- Used build options: -DWARP_SIZE_TEST=64 -D_AMD_SOURCE_
> -DGMX_OCL_FASTGEN -DEL_CUTOFF -DEELNAME=_ElecCut -DLJ_COMB_GEOM
> -DVDWNAME=_VdwLJCombGeom -DCENTRAL=22
> -DNBNXN_GPU_NCLUSTER_PER_SUPERCLUSTER=8 -DNBNXN_GPU_CLUSTER_SIZE=8
> -DNBNXN_GPU_JGROUP_SIZE=4 -DGMX_NBNXN_PRUNE_KERNEL_J4_CONCURRENCY=4
> -DNBNXN_MIN_RSQ=3.82e-07f -DIATYPE_SHMEM -cl-fast-relaxed-math
> -cl-denorms-are-zero
> -I/Users/michael/.local/source/gromacs-2018.5/src/gromacs/mdlib/nbnxn_ocl
> --------------LOG START---------------
> <program source>:80:10: fatal error: 'nbnxn_ocl_kernel_pruneonly.clh' file
> not found
> #include "nbnxn_ocl_kernel_pruneonly.clh"
>          ^
> ---------------LOG END----------------
>
> -------------------------------------------------------
> Program:     mdrun-mpi-test, version 2018.5
> Source file: src/gromacs/gpu_utils/ocl_compiler.cpp (line 507)
> Function:    cl_program gmx::ocl::compileProgram(FILE *, const std::string
> &, const std::string &, cl_context, cl_device_id, ocl_vendor_id_t)
> MPI rank:    1 (out of 2)
>
> Internal error (bug):
> Failed to compile NBNXN kernels for GPU #AMD Radeon Pro 560 Compute Engine
>   Could not build OpenCL program, error was CL_BUILD_PROGRAM_FAILURE
>
> ***ERROR LOG WITH MODIFIED GPU_UTILS_OCL.CPP:
>
> Can not increase nstlist because an NVE ensemble is used
> Using 1 MPI thread
> Using 1 OpenMP thread
>
> 1 GPU auto-selected for this run.
> Mapping of GPU IDs to the 1 GPU task in the 1 rank on this node:
>   PP:0
> Compilation of source file
> /Users/michael/.local/source/gromacs-2018.5-mod/src/gromacs/mdlib/nbnxn_ocl/
> nbnxn_ocl_kernels.cl failed!
> -- Used build options: -DWARP_SIZE_TEST=64 -D_AMD_SOURCE_
> -DGMX_OCL_FASTGEN -DEL_CUTOFF -DEELNAME=_ElecCut -DLJ_COMB_GEOM
> -DVDWNAME=_VdwLJCombGeom -DCENTRAL=22
> -DNBNXN_GPU_NCLUSTER_PER_SUPERCLUSTER=8 -DNBNXN_GPU_CLUSTER_SIZE=8
> -DNBNXN_GPU_JGROUP_SIZE=4 -DGMX_NBNXN_PRUNE_KERNEL_J4_CONCURRENCY=4
> -DNBNXN_MIN_RSQ=3.82e-07f -DIATYPE_SHMEM -cl-fast-relaxed-math
> -cl-denorms-are-zero
> -I/Users/michael/.local/source/gromacs-2018.5-mod/src/gromacs/mdlib/nbnxn_ocl
> --------------LOG START---------------
> <program source>:80:10: fatal error: 'nbnxn_ocl_kernel_pruneonly.clh' file
> not found
> #include "nbnxn_ocl_kernel_pruneonly.clh"
>          ^
> ---------------LOG END----------------
>
> -------------------------------------------------------
> Program:     mdrun-test, version 2018.5
> Source file: src/gromacs/gpu_utils/ocl_compiler.cpp (line 507)
> Function:    cl_program gmx::ocl::compileProgram(FILE *, const std::string
> &, const std::string &, cl_context, cl_device_id, ocl_vendor_id_t)
>
> Internal error (bug):
> Failed to compile NBNXN kernels for GPU #AMD Radeon Pro 560 Compute Engine
>   Could not build OpenCL program, error was CL_BUILD_PROGRAM_FAILURE
>
>
>
>
>
>
>
>
> > On Feb 20, 2019, at 3:40 AM, Szilárd Páll <pall.szilard at gmail.com>
> wrote:
> >
> > We had some issues with the OS X OpenCL compilers being "special" and not
> > accepting standard ways of passing include arguments.
> >
> > Can you try editing the
> > src/gromacs/gpu_utils/gpu_utils_ocl.cpp
> > file and replace "#ifdef __APPLE__" with "#if 0", compile the code and
> see
> > if that works?
> >
> > --
> > Szilárd
> >
> >
> > On Tue, Feb 19, 2019 at 2:08 AM Michael Williams <
> > michael.r.c.williams at gmail.com <mailto:michael.r.c.williams at gmail.com>>
> wrote:
> >
> >> Hi, I’ve been trying to build Gromacs 2018.3 on my MacBook Pro (in OSX
> >> 10.14.3). I saw online (https://redmine.gromacs.org/issues/2369 <
> https://redmine.gromacs.org/issues/2369> <
> >> https://redmine.gromacs.org/issues/2369 <
> https://redmine.gromacs.org/issues/2369>>) that Gromacs with GPU support
> >> via OpenCL was found to work a similar computer, but I have not had any
> >> luck. Is there a way to see what settings (compiler, CMake variables,
> etc)
> >> were used for that build? Or if anyone has any suggestions, I’d be very
> >> grateful. Thanks for your help,
> >>
> >> Mike
> >>
> >> The errors that I have been getting while running “make check” look
> like:
> >>
> >>
> >> 1 GPU auto-selected for this run.
> >> Mapping of GPU IDs to the 1 GPU task in the 1 rank on this node:
> >>  PP:0
> >> Compilation of source file
> >> /Users/michael/.local/source/gromacs-2018.3/src/gromacs/mdlib/nbnxn_ocl/
> >> nbnxn_ocl_kernels.cl failed!
> >> -- Used build options: -DWARP_SIZE_TEST=64 -D_AMD_SOURCE_
> >> -DGMX_OCL_FASTGEN -DEL_CUTOFF -DEELNAME=_ElecCut -DLJ_COMB_GEOM
> >> -DVDWNAME=_VdwLJCombGeom -DCENTRAL=22
> >> -DNBNXN_GPU_NCLUSTER_PER_SUPERCLUSTER=8 -DNBNXN_GPU_CLUSTER_SIZE=8
> >> -DNBNXN_GPU_JGROUP_SIZE=4 -DGMX_NBNXN_PRUNE_KERNEL_J4_CONCURRENCY=4
> >> -DNBNXN_MIN_RSQ=3.82e-07f -DIATYPE_SHMEM -cl-fast-relaxed-math
> >> -cl-denorms-are-zero
> >>
> -I/Users/michael/.local/source/gromacs-2018.3/src/gromacs/mdlib/nbnxn_ocl
> >> --------------LOG START---------------
> >> <program source>:80:10: fatal error: 'nbnxn_ocl_kernel_pruneonly.clh'
> file
> >> not found
> >> #include "nbnxn_ocl_kernel_pruneonly.clh"
> >>         ^
> >> ---------------LOG END----------------
> >>
> >> -------------------------------------------------------
> >> Program:     mdrun-test, version 2018.3
> >> Source file: src/gromacs/gpu_utils/ocl_compiler.cpp (line 507)
> >> Function:    cl_program gmx::ocl::compileProgram(FILE *, const
> std::string
> >> &, const std::string &, cl_context, cl_device_id, ocl_vendor_id_t)
> >>
> >> Internal error (bug):
> >> Failed to compile NBNXN kernels for GPU #AMD Radeon Pro 560 Compute
> Engine
> >>  Could not build OpenCL program, error was CL_BUILD_PROGRAM_FAILURE
> >> --
> >> Gromacs Users mailing list
> >>
> >> * Please search the archive at
> >> http://www.gromacs.org/Support/Mailing_Lists/GMX-Users_List <
> http://www.gromacs.org/Support/Mailing_Lists/GMX-Users_List> before
> >> posting!
> >>
> >> * Can't post? Read http://www.gromacs.org/Support/Mailing_Lists <
> http://www.gromacs.org/Support/Mailing_Lists>
> >>
> >> * For (un)subscribe requests visit
> >> https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-users <
> https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-users> or
> >> send a mail to gmx-users-request at gromacs.org <mailto:
> gmx-users-request at gromacs.org>.
> > --
> > Gromacs Users mailing list
> >
> > * Please search the archive at
> http://www.gromacs.org/Support/Mailing_Lists/GMX-Users_List <
> http://www.gromacs.org/Support/Mailing_Lists/GMX-Users_List>before
> posting!
> >
> > * Can't post? Read http://www.gromacs.org/Support/Mailing_Lists <
> http://www.gromacs.org/Support/Mailing_Lists>
> >
> > * For (un)subscribe requests visit
> > https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-users <
> https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-users> or
> send a mail to gmx-users-request at gromacs.org <mailto:
> gmx-users-request at gromacs.org>.
>
> --
> Gromacs Users mailing list
>
> * Please search the archive at
> http://www.gromacs.org/Support/Mailing_Lists/GMX-Users_List before
> posting!
>
> * Can't post? Read http://www.gromacs.org/Support/Mailing_Lists
>
> * For (un)subscribe requests visit
> https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-users or
> send a mail to gmx-users-request at gromacs.org.


More information about the gromacs.org_gmx-users mailing list