h2oai / h2o-3

H2O is an Open Source, Distributed, Fast & Scalable Machine Learning Platform: Deep Learning, Gradient Boosting (GBM) & XGBoost, Random Forest, Generalized Linear Modeling (GLM with Elastic Net), K-Means, PCA, Generalized Additive Models (GAM), RuleFit, Support Vector Machine (SVM), Stacked Ensembles, Automatic Machine Learning (AutoML), etc.
http://h2o.ai
Apache License 2.0
6.9k stars 2k forks source link

Deep Learning POJO not thread safe #9603

Closed exalate-issue-sync[bot] closed 1 year ago

exalate-issue-sync[bot] commented 1 year ago

On Feb 17, 2016, at 7:10 AM, Jamie MacLennan heyjamiemac@gmail.com wrote:

I'm sorry, I may be confused, but how is the code thread safe if there are lines like this:

ACTIVATION[i][r] = Math.max(0, ACTIVATION[i][r]);

Where ACTIVATION is defined as:

public static final double[][] ACTIVATION = new double[][] { / Input / dl0_Activation_0.VALUES, / Rectifier / dl0_Activation_1.VALUES, / Rectifier / dl0_Activation_2.VALUES, / Softmax / dl0_Activation_3.VALUES };

Since all the local storage for the generated class is static, everything is overwritten by multiple threads.

Am I missing something? (I ask because I get different results from a multithreaded version of my code than from a single threaded, so I looked into the generated class and found this)

Thanks

On Wednesday, February 17, 2016 at 2:54:38 AM UTC-8, Tom Kraljevic wrote:

the generated pojo code is thread safe.

and if you are using the "easy" pojo api model wrappers, you can allocate the wrappers up front and share them across threads, as shown in the building a smarter application code example.

tom

Sent from my iPhone

On Feb 16, 2016, at 10:04 PM, Jamie MacLennan heyja...@gmail.com wrote:

Is there any reason why the generated predictor code isn't thread safe? Are there any "easy" ways to change all the static variables so the classes can be used by multiple threads?

h2o-ops commented 1 year ago

JIRA Issue Migration Info

Jira Issue: PUBDEV-2664 Assignee: Arno Candel Reporter: Tom Kraljevic State: Resolved Fix Version: N/A Attachments: N/A Development PRs: N/A