Why netlib-java native blas/lapack libraries doesn't give performance improvement?












5















I am using this piece of code to calculate spark recommendations:



    SparkSession spark = SparkSession
.builder()
.appName("SomeAppName")
.config("spark.master", "local[" + args[2] + "]")
.config("spark.local.dir",args[4])
.getOrCreate();
JavaRDD<Rating> ratingsRDD = spark
.read().textFile(args[0]).javaRDD()
.map(Rating::parseRating);
Dataset<Row> ratings = spark.createDataFrame(ratingsRDD, Rating.class);
ALS als = new ALS()
.setMaxIter(Integer.parseInt(args[3]))
.setRegParam(0.01)
.setUserCol("userId")
.setItemCol("movieId")
.setRatingCol("rating").setImplicitPrefs(true);

ALSModel model = als.fit(ratings);
model.setColdStartStrategy("drop");
Dataset<Row> rowDataset = model.recommendForAllUsers(50);


These are maven dependencies to make this piece of code work:



    <dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_2.11</artifactId>
<version>2.4.0</version>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-sql_2.11</artifactId>
<version>2.4.0</version>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-mllib_2.11</artifactId>
<version>2.4.0</version>
</dependency>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>2.11.8</version>
</dependency>


Calculating recommendations with this code takes ~70sec for my data file. This code produces following warning:



WARN BLAS: Failed to load implementation from: com.github.fommil.netlib.NativeSystemBLAS
WARN BLAS: Failed to load implementation from: com.github.fommil.netlib.NativeRefBLAS
WARN LAPACK: Failed to load implementation from: com.github.fommil.netlib.NativeSystemLAPACK
WARN LAPACK: Failed to load implementation from: com.github.fommil.netlib.NativeRefLAPACK


Now I try to enable netlib-java by adding this dependency in maven:



    <dependency>
<groupId>com.github.fommil.netlib</groupId>
<artifactId>all</artifactId>
<version>1.1.2</version>
<type>pom</type>
</dependency>


to avoid crashing of this new environment I had to do this extra trick:



LD_PRELOAD=/usr/lib64/libopenblas.so


Now it also works, it gives no warnings, but it works slower and it takes ~170sec on average to perform the same calculation. I am running this on CentOS.



Shouldn't it be faster with native libraries? Is it possible to make it faster?










share|improve this question























  • I was able to reproduce the warnings. However, I am able to get the result and all the results in the Spark example (Spark docs) within 8 seconds and even with show() I got it in 16 seconds. What parameters are using for setMaxIter() and master"local[" + args[2] + "]"? I am using 10 and 2 respectively.

    – Nikhil
    Jan 4 at 14:02











  • Can you share the dataset may be I am using the smaller one?

    – Nikhil
    Jan 4 at 14:06











  • drive.google.com/file/d/16a-U43TDUp8_U3oRG30bq08t51HhZbgd/view

    – Stepan Yakovenko
    Jan 4 at 16:25











  • you can set maxiter to ~100 for example, to get long time running

    – Stepan Yakovenko
    Jan 5 at 8:05
















5















I am using this piece of code to calculate spark recommendations:



    SparkSession spark = SparkSession
.builder()
.appName("SomeAppName")
.config("spark.master", "local[" + args[2] + "]")
.config("spark.local.dir",args[4])
.getOrCreate();
JavaRDD<Rating> ratingsRDD = spark
.read().textFile(args[0]).javaRDD()
.map(Rating::parseRating);
Dataset<Row> ratings = spark.createDataFrame(ratingsRDD, Rating.class);
ALS als = new ALS()
.setMaxIter(Integer.parseInt(args[3]))
.setRegParam(0.01)
.setUserCol("userId")
.setItemCol("movieId")
.setRatingCol("rating").setImplicitPrefs(true);

ALSModel model = als.fit(ratings);
model.setColdStartStrategy("drop");
Dataset<Row> rowDataset = model.recommendForAllUsers(50);


These are maven dependencies to make this piece of code work:



    <dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_2.11</artifactId>
<version>2.4.0</version>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-sql_2.11</artifactId>
<version>2.4.0</version>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-mllib_2.11</artifactId>
<version>2.4.0</version>
</dependency>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>2.11.8</version>
</dependency>


Calculating recommendations with this code takes ~70sec for my data file. This code produces following warning:



WARN BLAS: Failed to load implementation from: com.github.fommil.netlib.NativeSystemBLAS
WARN BLAS: Failed to load implementation from: com.github.fommil.netlib.NativeRefBLAS
WARN LAPACK: Failed to load implementation from: com.github.fommil.netlib.NativeSystemLAPACK
WARN LAPACK: Failed to load implementation from: com.github.fommil.netlib.NativeRefLAPACK


Now I try to enable netlib-java by adding this dependency in maven:



    <dependency>
<groupId>com.github.fommil.netlib</groupId>
<artifactId>all</artifactId>
<version>1.1.2</version>
<type>pom</type>
</dependency>


to avoid crashing of this new environment I had to do this extra trick:



LD_PRELOAD=/usr/lib64/libopenblas.so


Now it also works, it gives no warnings, but it works slower and it takes ~170sec on average to perform the same calculation. I am running this on CentOS.



Shouldn't it be faster with native libraries? Is it possible to make it faster?










share|improve this question























  • I was able to reproduce the warnings. However, I am able to get the result and all the results in the Spark example (Spark docs) within 8 seconds and even with show() I got it in 16 seconds. What parameters are using for setMaxIter() and master"local[" + args[2] + "]"? I am using 10 and 2 respectively.

    – Nikhil
    Jan 4 at 14:02











  • Can you share the dataset may be I am using the smaller one?

    – Nikhil
    Jan 4 at 14:06











  • drive.google.com/file/d/16a-U43TDUp8_U3oRG30bq08t51HhZbgd/view

    – Stepan Yakovenko
    Jan 4 at 16:25











  • you can set maxiter to ~100 for example, to get long time running

    – Stepan Yakovenko
    Jan 5 at 8:05














5












5








5


2






I am using this piece of code to calculate spark recommendations:



    SparkSession spark = SparkSession
.builder()
.appName("SomeAppName")
.config("spark.master", "local[" + args[2] + "]")
.config("spark.local.dir",args[4])
.getOrCreate();
JavaRDD<Rating> ratingsRDD = spark
.read().textFile(args[0]).javaRDD()
.map(Rating::parseRating);
Dataset<Row> ratings = spark.createDataFrame(ratingsRDD, Rating.class);
ALS als = new ALS()
.setMaxIter(Integer.parseInt(args[3]))
.setRegParam(0.01)
.setUserCol("userId")
.setItemCol("movieId")
.setRatingCol("rating").setImplicitPrefs(true);

ALSModel model = als.fit(ratings);
model.setColdStartStrategy("drop");
Dataset<Row> rowDataset = model.recommendForAllUsers(50);


These are maven dependencies to make this piece of code work:



    <dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_2.11</artifactId>
<version>2.4.0</version>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-sql_2.11</artifactId>
<version>2.4.0</version>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-mllib_2.11</artifactId>
<version>2.4.0</version>
</dependency>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>2.11.8</version>
</dependency>


Calculating recommendations with this code takes ~70sec for my data file. This code produces following warning:



WARN BLAS: Failed to load implementation from: com.github.fommil.netlib.NativeSystemBLAS
WARN BLAS: Failed to load implementation from: com.github.fommil.netlib.NativeRefBLAS
WARN LAPACK: Failed to load implementation from: com.github.fommil.netlib.NativeSystemLAPACK
WARN LAPACK: Failed to load implementation from: com.github.fommil.netlib.NativeRefLAPACK


Now I try to enable netlib-java by adding this dependency in maven:



    <dependency>
<groupId>com.github.fommil.netlib</groupId>
<artifactId>all</artifactId>
<version>1.1.2</version>
<type>pom</type>
</dependency>


to avoid crashing of this new environment I had to do this extra trick:



LD_PRELOAD=/usr/lib64/libopenblas.so


Now it also works, it gives no warnings, but it works slower and it takes ~170sec on average to perform the same calculation. I am running this on CentOS.



Shouldn't it be faster with native libraries? Is it possible to make it faster?










share|improve this question














I am using this piece of code to calculate spark recommendations:



    SparkSession spark = SparkSession
.builder()
.appName("SomeAppName")
.config("spark.master", "local[" + args[2] + "]")
.config("spark.local.dir",args[4])
.getOrCreate();
JavaRDD<Rating> ratingsRDD = spark
.read().textFile(args[0]).javaRDD()
.map(Rating::parseRating);
Dataset<Row> ratings = spark.createDataFrame(ratingsRDD, Rating.class);
ALS als = new ALS()
.setMaxIter(Integer.parseInt(args[3]))
.setRegParam(0.01)
.setUserCol("userId")
.setItemCol("movieId")
.setRatingCol("rating").setImplicitPrefs(true);

ALSModel model = als.fit(ratings);
model.setColdStartStrategy("drop");
Dataset<Row> rowDataset = model.recommendForAllUsers(50);


These are maven dependencies to make this piece of code work:



    <dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_2.11</artifactId>
<version>2.4.0</version>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-sql_2.11</artifactId>
<version>2.4.0</version>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-mllib_2.11</artifactId>
<version>2.4.0</version>
</dependency>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>2.11.8</version>
</dependency>


Calculating recommendations with this code takes ~70sec for my data file. This code produces following warning:



WARN BLAS: Failed to load implementation from: com.github.fommil.netlib.NativeSystemBLAS
WARN BLAS: Failed to load implementation from: com.github.fommil.netlib.NativeRefBLAS
WARN LAPACK: Failed to load implementation from: com.github.fommil.netlib.NativeSystemLAPACK
WARN LAPACK: Failed to load implementation from: com.github.fommil.netlib.NativeRefLAPACK


Now I try to enable netlib-java by adding this dependency in maven:



    <dependency>
<groupId>com.github.fommil.netlib</groupId>
<artifactId>all</artifactId>
<version>1.1.2</version>
<type>pom</type>
</dependency>


to avoid crashing of this new environment I had to do this extra trick:



LD_PRELOAD=/usr/lib64/libopenblas.so


Now it also works, it gives no warnings, but it works slower and it takes ~170sec on average to perform the same calculation. I am running this on CentOS.



Shouldn't it be faster with native libraries? Is it possible to make it faster?







maven apache-spark-mllib recommender-systems netlib-java






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Dec 24 '18 at 17:02









Stepan YakovenkoStepan Yakovenko

1,1031255111




1,1031255111













  • I was able to reproduce the warnings. However, I am able to get the result and all the results in the Spark example (Spark docs) within 8 seconds and even with show() I got it in 16 seconds. What parameters are using for setMaxIter() and master"local[" + args[2] + "]"? I am using 10 and 2 respectively.

    – Nikhil
    Jan 4 at 14:02











  • Can you share the dataset may be I am using the smaller one?

    – Nikhil
    Jan 4 at 14:06











  • drive.google.com/file/d/16a-U43TDUp8_U3oRG30bq08t51HhZbgd/view

    – Stepan Yakovenko
    Jan 4 at 16:25











  • you can set maxiter to ~100 for example, to get long time running

    – Stepan Yakovenko
    Jan 5 at 8:05



















  • I was able to reproduce the warnings. However, I am able to get the result and all the results in the Spark example (Spark docs) within 8 seconds and even with show() I got it in 16 seconds. What parameters are using for setMaxIter() and master"local[" + args[2] + "]"? I am using 10 and 2 respectively.

    – Nikhil
    Jan 4 at 14:02











  • Can you share the dataset may be I am using the smaller one?

    – Nikhil
    Jan 4 at 14:06











  • drive.google.com/file/d/16a-U43TDUp8_U3oRG30bq08t51HhZbgd/view

    – Stepan Yakovenko
    Jan 4 at 16:25











  • you can set maxiter to ~100 for example, to get long time running

    – Stepan Yakovenko
    Jan 5 at 8:05

















I was able to reproduce the warnings. However, I am able to get the result and all the results in the Spark example (Spark docs) within 8 seconds and even with show() I got it in 16 seconds. What parameters are using for setMaxIter() and master"local[" + args[2] + "]"? I am using 10 and 2 respectively.

– Nikhil
Jan 4 at 14:02





I was able to reproduce the warnings. However, I am able to get the result and all the results in the Spark example (Spark docs) within 8 seconds and even with show() I got it in 16 seconds. What parameters are using for setMaxIter() and master"local[" + args[2] + "]"? I am using 10 and 2 respectively.

– Nikhil
Jan 4 at 14:02













Can you share the dataset may be I am using the smaller one?

– Nikhil
Jan 4 at 14:06





Can you share the dataset may be I am using the smaller one?

– Nikhil
Jan 4 at 14:06













drive.google.com/file/d/16a-U43TDUp8_U3oRG30bq08t51HhZbgd/view

– Stepan Yakovenko
Jan 4 at 16:25





drive.google.com/file/d/16a-U43TDUp8_U3oRG30bq08t51HhZbgd/view

– Stepan Yakovenko
Jan 4 at 16:25













you can set maxiter to ~100 for example, to get long time running

– Stepan Yakovenko
Jan 5 at 8:05





you can set maxiter to ~100 for example, to get long time running

– Stepan Yakovenko
Jan 5 at 8:05












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53915999%2fwhy-netlib-java-native-blas-lapack-libraries-doesnt-give-performance-improvemen%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53915999%2fwhy-netlib-java-native-blas-lapack-libraries-doesnt-give-performance-improvemen%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Mossoró

Error while reading .h5 file using the rhdf5 package in R

Pushsharp Apns notification error: 'InvalidToken'