Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to specify cpu cores to speed up trainning #81

Closed
wanghaisheng opened this issue May 10, 2016 · 8 comments
Closed

how to specify cpu cores to speed up trainning #81

wanghaisheng opened this issue May 10, 2016 · 8 comments

Comments

@wanghaisheng
Copy link

if i want to run the following tests


#!/bin/bash
set -x
set -a
test -d book || {
    wget -nd http://tmbdev.net/ocrdata/uw3-500.tgz
    tar -xzf uw3-500.tgz
}
find book -name '*.bin.png' | sort -r > uw3-all
sed 1,50d uw3-all > uw3-train
sed 50q uw3-all > uw3-test
report_every=10
save_every=1000
ntrain=200000
dewarp=center
display_every=10
test_every=10000
display_every=100
testset=uw3-test.h5
hidden=800
lrate=1e-4
save_name=uw3-500
report_time=1
# gdb --ex run --args \
./clstmocrtrain uw3-train uw3-test

lets say i have 32 cores,how to specify cpu cores to speed up trainning

@striversist
Copy link

Have you found the way to train on multi-CPU cores?

@wanghaisheng
Copy link
Author

@striversist sadly no

@tmbdev
Copy link
Owner

tmbdev commented Nov 3, 2016

You should be able to enable multicore operations for Eigen. See the EIgen3 documentation.

@wanghaisheng
Copy link
Author

@tmbdev there is two option to enable multithreading. but where and which class should i edit
http://eigen.tuxfamily.org/dox/TopicMultiThreading.html


OMP_NUM_THREADS=n ./my_program
omp_set_num_threads(n);
Eigen::setNbThreads(n);

@amitdo
Copy link
Contributor

amitdo commented Nov 3, 2016

OMP_NUM_THREADS=n ./my_program

Here you set an environment variable when running my_program.

omp_set_num_threads(n);
Eigen::setNbThreads(n);

These two are functions, so you should use them within your code.
The first function is from the openmp library.
The second function is from Eigen.

All these options will do the same thing.

However, none of them will have any effect without enabling openmp support as part of compiling.
The current scon script doesn't have an option to enable openmp. Some previous version of this script did have it.

@amitdo
Copy link
Contributor

amitdo commented Nov 3, 2016

Currently, the following algorithms can make use of multi-threading: general matrix - matrix products PartialPivLU

So it seems that even if you'll enable openmp, there will be no effect.

@tmbdev
Copy link
Owner

tmbdev commented Nov 4, 2016

Actually, many of the computations are matrix-matrix products. However, I believe that for normal parameter settings, there isn't much of a speedup; for large models it may help. If you want to try it, you can simply add the flags back to the compilation.

@wanghaisheng
Copy link
Author

i am running a training over chinese character for 5 months ,iteration times is 700000
error rate still above 3.0

kba added a commit to kba/clstm that referenced this issue Nov 6, 2016
kba added a commit to kba/clstm that referenced this issue Dec 8, 2017
kba added a commit to kba/clstm that referenced this issue Dec 8, 2017
zuphilip added a commit that referenced this issue Dec 8, 2017
Add option 'openmp' to SConstruct, #81
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants