17
$\begingroup$

Wolfram offers several services for running code in the cloud: Mathematica Online, Programming Cloud, CloudEvaluate, etc.

How can a piece of code detect if it is being run in the cloud or the standard version of Mathematica?

Certain features, such as running external programs, are not available in the cloud. A package might want to check if it's running in Mathematica Online and abort or adapt accordingly, for example replace a fast LibraryLink-based implementation of a function with a slower pure Mathematica one.

$\endgroup$

1 Answer 1

16
$\begingroup$

You are looking for $CloudEvaluation system variable.

For example:

$CloudEvaluation

(* False *)

and

CloudEvaluate[$CloudEvaluation]

(* True *)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.