const gmx_device_info_t *dev_info);
+
+#ifdef HAVE_CUDA_TEXOBJ_SUPPORT
+static bool use_texobj(const gmx_device_info_t *dev_info)
+{
+ /* Only device CC >= 3.0 (Kepler and later) support texture objects */
+ return (dev_info->prop.major >= 3);
+}
+#endif
+
/*! Tabulates the Ewald Coulomb force and initializes the size/scale
and the table GPU array. If called with an already allocated table,
it just re-uploads the table.
#ifdef HAVE_CUDA_TEXOBJ_SUPPORT
/* Only device CC >= 3.0 (Kepler and later) support texture objects */
- if (dev_info->prop.major >= 3)
+ if (use_texobj(dev_info))
{
cudaResourceDesc rd;
memset(&rd, 0, sizeof(rd));
#ifdef HAVE_CUDA_TEXOBJ_SUPPORT
/* Only device CC >= 3.0 (Kepler and later) support texture objects */
- if (dev_info->prop.major >= 3)
+ if (use_texobj(dev_info))
{
cudaResourceDesc rd;
cudaTextureDesc td;
{
#ifdef HAVE_CUDA_TEXOBJ_SUPPORT
/* Only device CC >= 3.0 (Kepler and later) support texture objects */
- if (dev_info->prop.major >= 3)
+ if (use_texobj(dev_info))
{
stat = cudaDestroyTextureObject(nbparam->coulomb_tab_texobj);
CU_RET_ERR(stat, "cudaDestroyTextureObject on coulomb_tab_texobj failed");
#ifdef HAVE_CUDA_TEXOBJ_SUPPORT
/* Only device CC >= 3.0 (Kepler and later) support texture objects */
- if (nb->dev_info->prop.major >= 3)
+ if (use_texobj(nb->dev_info))
{
stat = cudaDestroyTextureObject(nbparam->nbfp_texobj);
CU_RET_ERR(stat, "cudaDestroyTextureObject on nbfp_texobj failed");
{
#ifdef HAVE_CUDA_TEXOBJ_SUPPORT
/* Only device CC >= 3.0 (Kepler and later) support texture objects */
- if (nb->dev_info->prop.major >= 3)
+ if (use_texobj(nb->dev_info))
{
stat = cudaDestroyTextureObject(nbparam->nbfp_comb_texobj);
CU_RET_ERR(stat, "cudaDestroyTextureObject on nbfp_comb_texobj failed");