         if (system == cuda)
         {
             cudaSetDevice(compute_device);
+        }
+#endif
+
+#if ENABLE_TBB_BACKEND
+        // this object must stay alive on the stack for the scheduler to work
+        // this means we have to declare it even for the GPU path
+        tbb::task_scheduler_init init(tbb::task_scheduler_init::deferred);
+        if (system == intel_tbb)
+        {
+            init.initialize(compute_device);
         }
 #endif
 

        }
#endif

        firepony_postprocess(*context);
    }


            num_tbb_threads = command_line_options.cpu_threads;
        }

        return new firepony_device_pipeline<firepony::intel_tbb>(consumer_id, num_tbb_threads);
#endif

