Skip to content
Closed
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions conf/spark-env.sh.template
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,7 @@
# - SPARK_IDENT_STRING A string representing this instance of spark. (Default: $USER)
# - SPARK_NICENESS The scheduling priority for daemons. (Default: 0)
# - SPARK_NO_DAEMONIZE Run the proposed command in the foreground. It will not output a PID file.
# Options for native BLAS, like Intel MKL, OpenBLAS, and so on.
# You shoud enable these options if using native BLAS (see SPARK-21305).
# - MKL_NUM_THREADS=1 Disable multi-threading of Intel MKL
# - OPENBLAS_NUM_THREADS=1 Disable multi-threading of OpenBLAS
5 changes: 5 additions & 0 deletions docs/ml-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ To configure `netlib-java` / Breeze to use system optimised binaries, include
project and read the [netlib-java](https://github.com/fommil/netlib-java) documentation for your
platform's additional installation instructions.

The most popular native BLAS such as [Intel MKL](https://software.intel.com/en-us/mkl), [OpenBLAS](http://www.openblas.net), are based on multi-threading.
For example, when OpenBLAS is loaded, it will create a thread pool with `MAX_CPU_NUMBER` threads, and the threads are using spinlock by default, which will conflict with Spark.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it always worse? for example can it multi-thread a single computation? it's possible that's advantageous if the other tasks on the machine aren't CPU-intensive. But probably counterproductive if all the tasks are CPU intensive.

Maybe we can soften the language slightly, to say you might get better performance by setting these to 1.

Also I don't think users will know what spinlock or MAX_CPU_NUMBER is (not a Spark value?)

Also, I don't think we ever explain here what MKL or OpenBLAS is, in any docs. You might briefly mention that this is explained in the netlib docs.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


If using a native BLAS based on multi-threading, for the best performance you must set it to use single thread first ([SPARK-21305](https://issues.apache.org/jira/browse/SPARK-21305)).

To use MLlib in Python, you will need [NumPy](http://www.numpy.org) version 1.4 or newer.

[^1]: To learn more about the benefits and background of system optimised natives, you may wish to
Expand Down