   If none given, uses the default `*context*`."
   ([] (release-on-shutdown *context*))
   ([^CLContext ctx]
-    (when ctx
-      (.addShutdownHook
+     (when ctx
+       (.addShutdownHook
         (Runtime/getRuntime)
         (Thread. (fn [] (prn "releasing CL context...") (release ctx)))))))
 
 ;; # CL data type factories
 
 (defn ^CLContext make-context
-  "Creates a context on all available devices. The platform to be used is
-  implementation dependent."
-  [] (CLContext/create))
+  "Without arg, selects the platform with the latest OpenCL version and
+  creates a context on all available devices. Otherwise the argument must be
+  a CLPlatform or seq of CLDevices. If the plaform is given, the context will
+  be created on all devices."
+  ([] (CLContext/create))
+  ([platform-or-devices]
+     (cond
+      (isa? (type platform-or-devices) CLPlatform)
+        (CLContext/create ^CLPlatform platform-or-devices)
+      (sequential? platform-or-devices)
+        (CLContext/create (into-array CLDevice platform-or-devices))
+      :default (throw (IllegalArgumentException. "Argument must be a CLPlatform or seq of CLDevice")))))
 
 (defn ^CLProgram make-program
   "Creates an input stream for `src` and compiles it into a CLProgram using the


  Arguments and their default values:

      :context - existing CLContext or result of make-context
      :device  - existing CLDevice, device type keyword or result of
                 calling max-flops device for context
      :queue   - existing CLCommandQueue or result of calling
                 make-commandqueue for device
      :program - optional, no default, if given must be one of:
                 1) an input stream to the program's source code
                 2) a vector of input stream and build option keywords
                    (see build-options for possible values)"
  [& {:keys [context device queue program]}]
  (let [ctx (or context (make-context))]
    (with-context ctx
      (let [device (cond (nil? device) (max-device)
                     (keyword? device) (max-device ctx device)
                     :default device)
            queue (or queue (make-commandqueue device))
            program (when program
                      (if (vector? program)
                        (apply make-program program)
                        (make-program program)))]
      {:ctx ctx :device device :queue queue :program program}))))

(defn ^CLCommandQueue enqueue
  "Submits the given buffers and kernels to the current command `*queue*` for

(defn ^:private buffer-seq-generic
  [^Buffer b]
  (lazy-seq
   (when (pos? (.remaining b))
     (cons (.get b) (buffer-seq-generic b)))))

(defn buffer-seq
  "Produces a lazy-seq of the remaining values in the given NIO buffer."
