     }
 }
 
+template<typename OutputT, typename DeviceInputIteratorT, bool inplace>
+struct AllocateOutput {
+    static void run(OutputT *&d_out, DeviceInputIteratorT, int num_items) {
+        CubDebugExit(g_allocator.DeviceAllocate((void**)&d_out, sizeof(OutputT) * num_items));
+    }
+};
+
+template<typename OutputT>
+struct AllocateOutput<OutputT, OutputT *, true> {
+    static void run(OutputT *&d_out, OutputT *d_in, int num_items) {
+        d_out = d_in;
+    }
+};
 
 /**
  * Test DeviceScan for a given problem input


    // Run Test
    Test<BACKEND>(d_in, h_reference, num_items, scan_op, initial_value);

    // Cleanup
    if (h_in) delete[] h_in;

    typename            DeviceInputIteratorT,
    typename            OutputT,
    typename            ScanOpT,
    typename            InitialValueT,
    bool                inplace=false>
void Test(
    DeviceInputIteratorT    d_in,
    OutputT                 *h_reference,
