     InitialValueT   initial_value)
 {
     enum {
-        TOTAL_ITEMS = LOGICAL_WARP_THREADS * NUM_WARPS,
+        IS_ARCH_WARP = (LOGICAL_WARP_THREADS == CUB_WARP_THREADS(0)),
+        IS_POW_OF_TWO = ((LOGICAL_WARP_THREADS & (LOGICAL_WARP_THREADS - 1)) == 0),
+        TOTAL_WARPS = (IS_ARCH_WARP || IS_POW_OF_TWO) ? MAX_WARPS : 1,
+        TOTAL_ITEMS = LOGICAL_WARP_THREADS * TOTAL_WARPS,
     };
 
     // Allocate host arrays

/******************************************************************************
 * Copyright (c) 2011, Duane Merrill.  All rights reserved.
 * Copyright (c) 2011-2018, NVIDIA CORPORATION.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:

        printf("\n");
    }

    for (int w = 0; w < TOTAL_WARPS; ++w)
    {
        for (int i = 0; i < LOGICAL_WARP_THREADS; ++i)
        {
