/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
/* Define to 1 if yo have the <unistd.h> header file. */
#cmakedefine HAVE_UNISTD_H
+# ifdef __APPLE__
+// Mac OS 13.x has a bug where dispatch.h generates an error for OpenCL builds if
+// HAVE_UNISTD_H is merely defined, but not set to 1. Since unistd.h should always
+// be available on this platform we simply undefine and redefine it to 1 for now
+# undef HAVE_UNISTD_H
+# define HAVE_UNISTD_H 1
+#endif
/* Define to 1 if yo have the <pwd.h> header file. */
#cmakedefine01 HAVE_PWD_H
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
cl_uint numPlatforms;
cl_int status = clGetPlatformIDs(0, nullptr, &numPlatforms);
GMX_ASSERT(status != CL_INVALID_VALUE, "Incorrect call of clGetPlatformIDs detected");
+#ifdef cl_khr_icd
if (status == CL_PLATFORM_NOT_FOUND_KHR)
{
// No valid ICDs found
}
return false;
}
+#endif
GMX_RELEASE_ASSERT(status == CL_SUCCESS,
gmx::formatString("An unexpected value was returned from clGetPlatformIDs %u: %s",
status, ocl_get_error_string(status).c_str()).c_str());
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include <cstdio>
+#include <algorithm>
#include <string>
#include <vector>
return includePathOption;
}
+/*! \brief Replace duplicated spaces with a single one in string
+ *
+ * Only the first character will be kept for multiple adjacent characters that
+ * are both identical and where the first one returns true for isspace().
+ *
+ * \param str String that will be modified.
+ */
+static void
+removeExtraSpaces(std::string *str)
+{
+ GMX_RELEASE_ASSERT(str != nullptr, "A pointer to an actual string must be provided");
+ std::string::iterator newEnd =
+ std::unique( str->begin(), str->end(), [ = ](char a, char b){ return isspace(a) && (a == b); } );
+ str->erase(newEnd, str->end());
+}
+
/*! \brief Builds a string with build options for the OpenCL kernels
*
* \throws std::bad_alloc if out of memory. */
preprocessorOptions += ' ';
preprocessorOptions += makeKernelIncludePathOption(kernelRootPath);
+ // Mac OS (and maybe some other implementations) does not accept double spaces in options
+ removeExtraSpaces(&preprocessorOptions);
+
return preprocessorOptions;
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015,2016,2017,2018, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
{
" -DVDWNAME=_VdwLJ",
" -DLJ_COMB_GEOM -DVDWNAME=_VdwLJCombGeom",
- " -DLJ_COMB_LB -DVDWNAME=_VdwLJCombLB",
+ " -DLJ_COMB_LB -DVDWNAME=_VdwLJCombLB",
" -DLJ_FORCE_SWITCH -DVDWNAME=_VdwLJFsw",
" -DLJ_POT_SWITCH -DVDWNAME=_VdwLJPsw",
" -DLJ_EWALD_COMB_GEOM -DVDWNAME=_VdwLJEwCombGeom",