Using the LCG installed stuff
source /cvmfs/sft.cern.ch/lcg/views/LCG_88/x86_64-slc6-gcc49-opt/setup.sh
I intall tensorflow into the local HOME folder.
pip install --user tensorflow
Unfortunately it doesn't run due to a GLIBC conflict
http://lightofdawn.org/wiki/wiki.cgi/-wiki/NewAppsOnOldGlibc
readelf -V .local/lib/python2.7/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so
readelf -s .local/lib/python2.7/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so
The table .gnu.version_r starts at file offset 0x88a374
The symbol GLIBC_2.14 is located at offset 0x0040 (+ 0x88a374 = 0x88a3b4)
The symbol GLIBC_2.17 is located at offset 0x00a0 (+ 0x88a374 = 0x88a414)
The symbol GLIBC_2.15 is located at offset 0x00c0 (+ 0x88a374 = 0x88a434)
The symbol GLIBC_2.16 is located at offset 0x00e0 (+ 0x88a374 = 0x88a454)
Editing with vim
vim .local/lib/python2.7/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so
Switch to the hex editor mode and go to the corresponding line:
:%!xxd
/88a3b0
Find the flags 2-bytes (start at offset 88a3b8) change 0000 -> 0200.
Repeat for all the libraries. Then save with:
:%!xxd -r
:wq
Check that readelf -v
says Flags: WEAK
for the four libraries
Check that python complains about the missing memcpy
on import tensorflow
Here is the stubs file for the functions that tensorflow wants:
#include <time.h>
#include <string.h>
#include <stdlib.h>
void* memcpy(void *dest, const void *src, size_t n) { return memmove(dest, src, n); }
char *secure_getenv(const char *name) { return getenv(name); }
#include <sys/poll.h>
int __poll_chk (struct pollfd *fds, nfds_t nfds, int timeout, __SIZE_TYPE__ fdslen)
{
if (fdslen / sizeof (*fds) < nfds)
__chk_fail ();
return __poll (fds, nfds, timeout);
}
Compile with:
gcc -s -shared -o mylibc.so -fPIC -fno-builtin mylibc.c
And run python (or jupyter with)
LD_PRELOAD=$PWD/mylibc.so python