{"id":148422,"date":"2023-10-20T10:53:31","date_gmt":"2023-10-20T14:53:31","guid":{"rendered":"http:\/\/www.bu.edu\/tech\/?page_id=148422"},"modified":"2024-01-31T09:49:35","modified_gmt":"2024-01-31T14:49:35","slug":"intel-python","status":"publish","type":"page","link":"https:\/\/www.bu.edu\/tech\/support\/research\/software-and-programming\/common-languages\/python\/special\/intel-python\/","title":{"rendered":"Intel Python"},"content":{"rendered":"<p><a name=\"top\"><\/a><br \/>\nThe Intel Distribution for Python behaves like regular Python, but leverages Intel technologies to speed up many of the core python libraries, including NumPy, SciPy, Pandas, Scikit-Learn, Jupyter, matplotlib, and mpi4py. This distribution also integrates Intel Math Kernel Library (Intel MKL), Intel Data Analytics Acceleration Library (DAAL) and pyDAAL, Intel MPI Library, and Intel Threading Building Blocks (TBB). The following modules offer significant speedups for some computational workloads at the cost of potential incompatibility with other python packages.<\/p>\n<p><strong>Sections<\/strong><\/p>\n<ul>\n<li><a href=\"#use\">Using Python3-Intel<\/a>\n<li><a href=\"#optimize\">Optimizing on the SCC<\/a><\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p><a name=\"use\"><\/a><\/p>\n<h2>Using Python3-Intel<\/h2>\n<p>We recommend creating a virtualenv with one of the Python3-Intel modules. It&#8217;s also recommended to use the <code><b>--system-site-packages<\/code><\/b> flag to automatically install the Python packages we&#8217;ve already installed in the module.<\/p>\n<pre><code class=\"code-block\"><span class=\"prompt\">[rcs@scc1 ~]<\/span> <span class=\"command\">module load python3-intel\/2022.2.0<\/span>\r\n<span class=\"prompt\">[rcs@scc1 ~]<\/span> <span class=\"command\">virtualenv --system-site-packages<\/span> <span class=\"placeholder\">\/projectnb\/yourprojectname\/venvs\/mynewenv_intel<\/span>\r\n<span class=\"output\">New python executable in <span class=\"placeholder\">\/projectnb\/yourprojectname\/venvs\/mynewenv_intel\/<\/span>bin\/python<\/span>\r\n<span class=\"output\">Installing setuptools, pip, wheel...done.<\/span>\r\n<span class=\"prompt\">[rcs@scc1 ~]<\/span> <span class=\"command\">source<\/span> <span class=\"placeholder\">\/projectnb\/yourprojectname\/venvs\/mynewenv_intel\/<\/span>bin\/python<\/span>\r\n<span class=\"prompt\">(mynewenv_intel) [rcs@scc1 ~]<\/span> <span class=\"command\"<\/span><\/code><\/pre>\n<p>&nbsp;<\/p>\n<p><a name=\"optimize\"><\/a><\/p>\n<h2>Optimizing on the SCC<\/h2>\n<p>The optimizations available in the Intel Distribution of Python depend both OpenMP and Intel multi-processing libraries. Two environment variables are used\u00a0coordinate the automatic parallel processing: <code><span class=\"command\">OMP_NUM_THREADS<\/span><\/code> and <code><span class=\"command\">MKL_NUM_THREADS<\/span><\/code>. It is important to understand the impact of these variables on your code and define appropriate values when running your code. Most commonly,\u00a0you should set the value equal to the number of slots (<code><span class=\"command\">$NSLOTS<\/span><\/code>) your job requests, but not always. Please read\u00a0<a href=\"https:\/\/software.intel.com\/en-us\/articles\/intel-math-kernel-library-intel-mkl-using-intel-mkl-with-threaded-applications\">Intel&#8217;s guidance on threaded applications<\/a>.<\/p>\n<table>\n<tbody>\n<tr>\n<th>Module Name<\/th>\n<th>Description<\/th>\n<th>Default Value<\/th>\n<th>Recommended<\/th>\n<\/tr>\n<tr>\n<td><code><span class=\"command\">OMP_NUM_THREADS<\/span><\/code><\/td>\n<td>Sets the number of threads for OpenMP<\/td>\n<td style=\"text-align: center;\">1<\/td>\n<td style=\"text-align: center;\"><code><span class=\"command\">$NSLOTS<\/span><\/code><\/td>\n<\/tr>\n<tr>\n<td><code><span class=\"command\">MKL_NUM_THREADS<\/span><\/code><\/td>\n<td>Sets the number of threads for Intel Math Kernel Library<\/td>\n<td style=\"text-align: center;\">1<\/td>\n<td style=\"text-align: center;\"><code><span class=\"command\">$NSLOTS<\/span><\/code><\/td>\n<\/tr>\n<tr>\n<td><code><span class=\"command\">OPENBLAS_NUM_THREADS<\/span><\/code><\/td>\n<td>Sets the number of threads for OpenBLAS<\/td>\n<td style=\"text-align: center;\">1<\/td>\n<td style=\"text-align: center;\"><code><span class=\"command\">$NSLOTS<\/span><\/code><\/td>\n<\/tr>\n<tr>\n<td><code><span class=\"command\">NUMBA_NUM_THREADS<\/span><\/code><\/td>\n<td>Sets the number of threads for NUMBA<\/td>\n<td style=\"text-align: center;\">1<\/td>\n<td style=\"text-align: center;\"><code><span class=\"command\">$NSLOTS<\/span><\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<br \/>\n<a href=\"#top\">Back to top<\/a><\/p>\n<p style=\"text-align:right;\" id=\"demo\">\n<p><script>\r\nconst date = new Date(document.lastModified);\r\ndocument.getElementById(\"demo\").innerHTML = date;\r\n<\/script><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Intel Distribution for Python behaves like regular Python, but leverages Intel technologies to speed up many of the core python libraries, including NumPy, SciPy, Pandas, Scikit-Learn, Jupyter, matplotlib, and mpi4py. This distribution also integrates Intel Math Kernel Library (Intel MKL), Intel Data Analytics Acceleration Library (DAAL) and pyDAAL, Intel MPI Library, and Intel Threading&#8230;<\/p>\n","protected":false},"author":1692,"featured_media":0,"parent":148380,"menu_order":3,"comment_status":"closed","ping_status":"closed","template":"","meta":[],"_links":{"self":[{"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/pages\/148422"}],"collection":[{"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/users\/1692"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/comments?post=148422"}],"version-history":[{"count":10,"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/pages\/148422\/revisions"}],"predecessor-version":[{"id":150190,"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/pages\/148422\/revisions\/150190"}],"up":[{"embeddable":true,"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/pages\/148380"}],"wp:attachment":[{"href":"https:\/\/www.bu.edu\/tech\/wp-json\/wp\/v2\/media?parent=148422"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}