How can I set LD_PRELOAD for a Hadoop cluster?

9 views (last 30 days)
I am testing two scripts, one that uses Spark and one that uses MapReduce, on a Hadoop cluster running Red Hat Enterprise Linux 7.6. I am receiving the following error:
Error: failed /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.232.b09-0.el7_7.x86_64/jre/lib/amd64/server/libjvm.so, ...\nbecause /apps/matlab/R2020b/sys/os/glnxa64/libstdc++.so.6: undefined symbol: __cxa_thread_atexit_impl
This seems to be because the nodes have GLIBC 2.17 installed and this symbol starts being defined in GLIBC 2.18. I understand that there is a shim library for GLIBC 2.17 to work with MATLAB R2020b, but how can I force the cluster to find and load it?
 

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 5 Jan 2022
Edited: MathWorks Support Team on 20 Jan 2022
We can preload the library in the MATLAB scripts through cluster properties without modifying the system environment variables. The two scripts require slightly different code, because they are built on different technologies. In both of these, $MATLAB_ROOT needs to be replaced with the full path to the MATLAB installation on the worker.
For "mapreduce", modify your code as below:
cluster = parallel.cluster.Hadoop(..)\n...\ncluster.HadoopProperties('mapred.child.env') = 'LD_PRELOAD=$MATLAB_ROOT/bin/glnxa64/glibc-2.17_shim.so'\n...\nmapreducer(cluster)
For the Spark-based script, modify the code as below:
cluster = parallel.cluster.Hadoop(..)\n...\ncluster.SparkProperties('spark.executorEnv.LD_PRELOAD') = '$MATLAB_ROOT/bin/glnxa64/glibc-2.17_shim.so'\n...\nmapreducer(cluster)
Update:
This error may continue to be present after running the "mapreduce" script. The issue is likely related to "mapred.child.env", which is the legacy name for this configuration and the part of the workaround intended to allow mapreduce to work. Changing this to use the following configuration properties resolves the issue:
preloadEnv = 'LD_PRELOAD=$MATLAB_ROOT/bin/glnxa64/glibc-2.17_shim.so';\ncluster.HadoopProperties('mapreduce.map.env') = preloadEnv;\ncluster.HadoopProperties('mapreduce.reduce.env') = preloadEnv; \ncluster.HadoopProperties('yarn.app.mapreduce.am.env') = preloadEnv;

More Answers (0)

Products


Release

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!