<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Hello Emilio! in Software Archive</title>
    <link>https://community.intel.com/t5/Software-Archive/Got-to-work-Python-as-a-native-application/m-p/965837#M22837</link>
    <description>&lt;P&gt;Hello Emilio!&lt;/P&gt;
&lt;P&gt;This method is working fine, but i got some problems with numpy and another libs.&lt;/P&gt;
&lt;P&gt;Can you tell please, how you managed to install Numpy on mic?&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Thank you, and&amp;nbsp;sry for my poor english&lt;/P&gt;</description>
    <pubDate>Wed, 16 Oct 2013 17:31:00 GMT</pubDate>
    <dc:creator>Korotkoff__Al</dc:creator>
    <dc:date>2013-10-16T17:31:00Z</dc:date>
    <item>
      <title>Got to work Python as a native application</title>
      <link>https://community.intel.com/t5/Software-Archive/Got-to-work-Python-as-a-native-application/m-p/965831#M22831</link>
      <description>&lt;P&gt;Dear all,&lt;/P&gt;
&lt;P&gt;I have managed to crosscompile python and run it on the mic, In our research group we use python + multiprocessing module to build quick &amp;amp; fast prototypes. Since the mic architecture has 60 x86 cores I though it would be nice to give it a try.&lt;/P&gt;
&lt;P&gt;I want to share my thoughs about it because some people may find this interesting and useful.&lt;/P&gt;
&lt;P&gt;This python cross-compilation is mostly functional, although the ctypes module does not work. This module uses the libffi, a library where some parts are written in asm and use MMX instructions, so for the moment it is not possible to compile it directly for the xeon phi. I am working on trying to get it up &amp;amp; running.&lt;/P&gt;
&lt;P&gt;The main reference I used was this website:&amp;nbsp;http://randomsplat.com/id5-cross-compiling-python-for-embedded-linux.html&lt;/P&gt;
&lt;P&gt;I selected python 2.7.2.&lt;/P&gt;
&lt;P&gt;First of all you need to obtain a host working binary of the interpreter and the pgen this are build and executed during the build process so it will give an error if python is cross-compiled directly.&lt;/P&gt;
&lt;P&gt;this can be done with the usual "./configure &amp;amp;&amp;amp; make", then: "mv&amp;nbsp;python hostpython &amp;amp;&amp;amp;&amp;nbsp;mv&amp;nbsp;Parser/pgen Parser/hostpgen &amp;amp;&amp;amp; make distclean",&lt;/P&gt;
&lt;P&gt;now you have to download the following patch&amp;nbsp;&lt;A href="http://randomsplat.com/wp-content/uploads/2011/10/Python-2.7.2-xcompile.patch"&gt;Python-2.7.2-xcompile.patch&lt;/A&gt;&amp;nbsp;(there are patches for other versions at randomsplat). and apply it "patch -p1 &amp;lt; Python-2.7.2-xcompile.patch".&lt;/P&gt;
&lt;P&gt;Now we have to switch compilers and use the icc with -mmic option: I do recommend the following:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;./configure&amp;nbsp;CC="icc -mmic" &amp;nbsp;CXX="icpc -mmic" --host=x86_64 --without-gcc , put -mmic as part of the compiler name, I know it is dirty but when put at as a common flag it wont be used everywhere and the compilation will break.&lt;/P&gt;
&lt;P&gt;Now open the makefile and from BASECFLAGS remove&amp;nbsp;-OPT:Olimit=0, otherwise it will be giving annoying warnings for each file,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;make HOSTPYTHON=./hostpython HOSTPGEN=./Parser/hostpgen &amp;nbsp;CROSS_COMPILE=k1om- CROSS_COMPILE_TARGET=yes HOSTARCH=k1om BUILDARCH=x86_64-linux-gnu EXTRA_CFLAGS="-fp-model precise"&lt;/P&gt;
&lt;P&gt;the -fp-model precise is needed in order to avoid problems with fp airthmetic that makes the cmath test to fail.&lt;/P&gt;
&lt;P&gt;At the end it will tell us that ctypes module could not be built. As I said above, the x86 version of the libffi uses MMX instructions, so it should be ported to the intel mic. (If anyone knows how to make it work I will be very grateful).&lt;/P&gt;
&lt;P&gt;now do "make install HOSTPYTHON=./hostpython &amp;nbsp;CROSS_COMPILE_TARGET=yes prefix=~/Python-2.7.2/_install" it will copy us all the needed files in the folder _install.&lt;/P&gt;
&lt;P&gt;Before executing python on the mic, we need to copy all the required libraries from intel composer (which are nearly all), as root do:&lt;/P&gt;
&lt;P&gt;scp /opt/intel/composer_xe_2013.3.163/compiler/lib/mic/*.so* mic0:/lib64/&lt;/P&gt;
&lt;P&gt;now:&lt;/P&gt;
&lt;P&gt;scp -r &amp;nbsp;_install/ mic0:&lt;/P&gt;
&lt;P&gt;go to the mic and copy the _install/lib/python2.7 folder to /usr/lib/python2.7 (make the lib directory if it does not exists, you need to do it as root), also copy the _install/bin/ files to /usr/bin/&lt;/P&gt;
&lt;P&gt;Once this is done, you only need to set the following variable "export PYTHONHOME=/usr/ " and you can start pythoning by typing "python"!&lt;/P&gt;
&lt;P&gt;You have some tests available at&amp;nbsp;cd _install/lib/python2.7/test/&lt;/P&gt;
&lt;P&gt;[villar@phi-mic0 test]$ python test_cmath.py &lt;BR /&gt;test_abs (__main__.CMathTests) ... ok&lt;BR /&gt;test_cmath_matches_math (__main__.CMathTests) ... ok&lt;BR /&gt;test_constants (__main__.CMathTests) ... ok&lt;BR /&gt;test_input_type (__main__.CMathTests) ... ok&lt;BR /&gt;test_isinf (__main__.CMathTests) ... ok&lt;BR /&gt;test_isnan (__main__.CMathTests) ... ok&lt;BR /&gt;test_phase (__main__.CMathTests) ... ok&lt;BR /&gt;test_polar (__main__.CMathTests) ... ok&lt;BR /&gt;test_rect (__main__.CMathTests) ... ok&lt;BR /&gt;test_specific_values (__main__.CMathTests) ... ok&lt;BR /&gt;test_user_object (__main__.CMathTests) ... ok&lt;/P&gt;
&lt;P&gt;----------------------------------------------------------------------&lt;BR /&gt;Ran 11 tests in 0.405s&lt;/P&gt;
&lt;P&gt;I have run some tests succesfully but the&amp;nbsp;test___all__.py seems to be borked when searching files.&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;This is all, I hope this is useful and interesting to you, and excuse me for my poor english!&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 18 May 2013 09:34:20 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Got-to-work-Python-as-a-native-application/m-p/965831#M22831</guid>
      <dc:creator>Emilio_C_</dc:creator>
      <dc:date>2013-05-18T09:34:20Z</dc:date>
    </item>
    <item>
      <title>Hello Emilio,</title>
      <link>https://community.intel.com/t5/Software-Archive/Got-to-work-Python-as-a-native-application/m-p/965832#M22832</link>
      <description>&lt;P&gt;Hello Emilio,&lt;/P&gt;
&lt;P&gt;I verified your prodedure using python 2.7.2. It confirmed that it worked&amp;nbsp;well with my current system configuration: MPSS 2.1.6720-15, Intel(R) 64&amp;nbsp;Compiler XE version 14.0.0.051.&lt;/P&gt;
&lt;P&gt;I just want to add&amp;nbsp;one comment: in the procedure, we also need to copy the directory "/root/_install/include/python2.7" to "/usr/include/python2.7/" as well.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you very much for sharing the procedure.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Aug 2013 19:48:18 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Got-to-work-Python-as-a-native-application/m-p/965832#M22832</guid>
      <dc:creator>Loc_N_Intel</dc:creator>
      <dc:date>2013-08-07T19:48:18Z</dc:date>
    </item>
    <item>
      <title>Hello,</title>
      <link>https://community.intel.com/t5/Software-Archive/Got-to-work-Python-as-a-native-application/m-p/965833#M22833</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; I am following the same procedure but am stuck with the configure step I get the following error.&lt;/P&gt;
&lt;P&gt;snataraj@phileas:~/Python-2.7.5$ ./configure CC="icc -mmic" CXX="icpc -mmic" --host=x86_64&lt;BR /&gt;checking build system type... x86_64-unknown-linux-gnu&lt;BR /&gt;checking host system type... x86_64-pc-none&lt;BR /&gt;configure: error: Cross compiling required --host=HOST-TUPLE and --build=ARCH&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;can you pleae help me here?&lt;/P&gt;</description>
      <pubDate>Fri, 09 Aug 2013 09:56:16 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Got-to-work-Python-as-a-native-application/m-p/965833#M22833</guid>
      <dc:creator>Surya_Narayanan_N_</dc:creator>
      <dc:date>2013-08-09T09:56:16Z</dc:date>
    </item>
    <item>
      <title>Hello,</title>
      <link>https://community.intel.com/t5/Software-Archive/Got-to-work-Python-as-a-native-application/m-p/965834#M22834</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; I am following the same procedure but am stuck with the configure step I get the following error.&lt;/P&gt;
&lt;P&gt;snataraj@phileas:~/Python-2.7.5$ ./configure CC="icc -mmic" CXX="icpc -mmic" --host=x86_64&lt;BR /&gt;checking build system type... x86_64-unknown-linux-gnu&lt;BR /&gt;checking host system type... x86_64-pc-none&lt;BR /&gt;configure: error: Cross compiling required --host=HOST-TUPLE and --build=ARCH&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;can you pleae help me here?&lt;/P&gt;</description>
      <pubDate>Fri, 09 Aug 2013 09:56:19 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Got-to-work-Python-as-a-native-application/m-p/965834#M22834</guid>
      <dc:creator>Surya_Narayanan_N_</dc:creator>
      <dc:date>2013-08-09T09:56:19Z</dc:date>
    </item>
    <item>
      <title>Hi Surya,</title>
      <link>https://community.intel.com/t5/Software-Archive/Got-to-work-Python-as-a-native-application/m-p/965835#M22835</link>
      <description>&lt;P&gt;Hi Surya,&lt;/P&gt;
&lt;P&gt;I followed the instruction&amp;nbsp;including the option "--without-gcc" and it worked for me:&lt;/P&gt;
&lt;P&gt;./configure&amp;nbsp;CC="icc -mmic" &amp;nbsp;CXX="icpc -mmic" --host=x86_64 --without-gcc&lt;/P&gt;</description>
      <pubDate>Fri, 09 Aug 2013 17:45:31 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Got-to-work-Python-as-a-native-application/m-p/965835#M22835</guid>
      <dc:creator>Loc_N_Intel</dc:creator>
      <dc:date>2013-08-09T17:45:31Z</dc:date>
    </item>
    <item>
      <title>You are using Python-2.7.5</title>
      <link>https://community.intel.com/t5/Software-Archive/Got-to-work-Python-as-a-native-application/m-p/965836#M22836</link>
      <description>&lt;P&gt;You are using&amp;nbsp;Python-2.7.5&lt;/P&gt;
&lt;P&gt;The patch is for Python-2.7.2&lt;/P&gt;
&lt;P&gt;Btw, I ported the libffi to the xeon phi, and I have ctypes working properly, therefore numpy can be used too.&lt;BR /&gt;Right now I dont have access to the code, since I am away from my home institute, but I'll try to upload it once I get back home.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Aug 2013 04:09:40 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Got-to-work-Python-as-a-native-application/m-p/965836#M22836</guid>
      <dc:creator>Emilio_C_</dc:creator>
      <dc:date>2013-08-10T04:09:40Z</dc:date>
    </item>
    <item>
      <title>Hello Emilio!</title>
      <link>https://community.intel.com/t5/Software-Archive/Got-to-work-Python-as-a-native-application/m-p/965837#M22837</link>
      <description>&lt;P&gt;Hello Emilio!&lt;/P&gt;
&lt;P&gt;This method is working fine, but i got some problems with numpy and another libs.&lt;/P&gt;
&lt;P&gt;Can you tell please, how you managed to install Numpy on mic?&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Thank you, and&amp;nbsp;sry for my poor english&lt;/P&gt;</description>
      <pubDate>Wed, 16 Oct 2013 17:31:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Got-to-work-Python-as-a-native-application/m-p/965837#M22837</guid>
      <dc:creator>Korotkoff__Al</dc:creator>
      <dc:date>2013-10-16T17:31:00Z</dc:date>
    </item>
    <item>
      <title>Dear all,</title>
      <link>https://community.intel.com/t5/Software-Archive/Got-to-work-Python-as-a-native-application/m-p/965838#M22838</link>
      <description>&lt;P&gt;Dear all,&lt;/P&gt;
&lt;P&gt;Please find hereby attached a version of ctypes that works with the mic.&lt;/P&gt;
&lt;P&gt;We changed the code in libffi/x86/unix64.S to make it use the phi ABI, it was a prototype so its very dirty. I don't have access to the phi anymore so I didnt care about it too much. To see the changes I made you can diff the files in the x86 folder with the libffi provided at Python 2.7.3 in Modules/_ctypes/libffi if anyone wants to do a clean port to the phi using the code we wrote is more than welcome.&lt;/P&gt;
&lt;P&gt;This libffi should work straightforward and allow to compile Python with ctypes. Therefore allowing you to use numpy.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Just replace the Python-2.7.3/Modules/_ctypes folder with the attached one.&lt;/P&gt;
&lt;P&gt;Good luck! and just drop a line in case you have any problem,&lt;/P&gt;
&lt;P&gt;Kind regards.&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Oct 2013 18:09:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Got-to-work-Python-as-a-native-application/m-p/965838#M22838</guid>
      <dc:creator>Emilio_C_</dc:creator>
      <dc:date>2013-10-16T18:09:00Z</dc:date>
    </item>
    <item>
      <title>Hi Emilio et al, thank you</title>
      <link>https://community.intel.com/t5/Software-Archive/Got-to-work-Python-as-a-native-application/m-p/965839#M22839</link>
      <description>&lt;P&gt;Hi Emilio et al, thank you for sharing your experiences here!&lt;/P&gt;
&lt;P&gt;One comment / suggestion:&lt;/P&gt;
&lt;P&gt;rather than copy the files to the coprocessor (and take up even more ramdisk space) you might want to consider [NFS or other] mounting the install directory on the coprocessor directly.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Oct 2013 21:48:34 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Got-to-work-Python-as-a-native-application/m-p/965839#M22839</guid>
      <dc:creator>BelindaLiviero</dc:creator>
      <dc:date>2013-10-16T21:48:34Z</dc:date>
    </item>
    <item>
      <title>I'll write a longer update</title>
      <link>https://community.intel.com/t5/Software-Archive/Got-to-work-Python-as-a-native-application/m-p/965840#M22840</link>
      <description>&lt;P&gt;I'll write a longer update later, but in case it helps anyone else immediately, I've been doing a lot of work getting Numpy and Scipy to work on the Xeon Phi. YMMV but there is a Makefile that implements all the above and more here:&lt;/P&gt;

&lt;P&gt;&lt;A href="https://github.com/bpartridge/pyphi"&gt;https://github.com/bpartridge/pyphi&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 31 Jan 2014 20:12:05 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Got-to-work-Python-as-a-native-application/m-p/965840#M22840</guid>
      <dc:creator>Brenton_P_</dc:creator>
      <dc:date>2014-01-31T20:12:05Z</dc:date>
    </item>
  </channel>
</rss>

