LightGBM icon indicating copy to clipboard operation
LightGBM copied to clipboard

tag v2.0, application blocked while tree_learner is data

Open hlee13 opened this issue 9 years ago • 21 comments

Environment info

Operating System: linux CPU: C++/Python/R version:

but application run ok while tree_learner is feature

Error Message:

pstack ${process_id}, info below: Thread 2 (Thread 0x7f6c8e9c4700 (LWP 32881)): #0 0x00007f6d7c40eb32 in gomp_barrier_wait_end () from /usr/local/gcc/lib64/libgomp.so.1 #1 0x00007f6d7c40d36e in gomp_thread_start () from /usr/local/gcc/lib64/libgomp.so.1 #2 0x00000037be407a51 in start_thread () from /lib64/libpthread.so.0 #3 0x00000037be0e896d in clone () from /lib64/libc.so.6 Thread 1 (Thread 0x7f6d7c1ec780 (LWP 32804)): #0 0x00000037be40ed5c in send () from /lib64/libpthread.so.0 #1 0x00000000004adcec in LightGBM::Network::ReduceScatter(char*, int, int const*, int const*, char*, std::function<void ()(char const*, char*, int)> const&) () #2 0x00000000004af45b in LightGBM::DataParallelTreeLearner::FindBestThresholds() () #3 0x00000000004b3579 in LightGBM::SerialTreeLearner::Train(float const*, float const*) () #4 0x00000000004440e8 in LightGBM::GBDT::TrainOneIter(float const*, float const*, bool) () #5 0x0000000000427616 in LightGBM::Application::Train() () #6 0x0000000000426762 in main ()

APPLICATION OUTPUT LOGS

[LightGBM] [Info] Connected to rank 1 [LightGBM] [Info] Local rank: 0, total number of machines: 2 [LightGBM] [Info] Finished initializing network [LightGBM] [Warning] File data.train.bin existed, cannot save binary to it [LightGBM] [Warning] File data.validate.bin existed, cannot save binary to it [LightGBM] [Info] Finished loading data in 71.173277 seconds [LightGBM] [Info] Total Bins 88115 [LightGBM] [Info] Number of data: 40240974, number of used features: 447 [LightGBM] [Info] Finished initializing training [LightGBM] [Info] Started training...

Steps to reproduce

1. 2. 3.

hlee13 avatar Jun 07 '17 07:06 hlee13

@hlee13 Do you have error message of rank_1 ?

guolinke avatar Jun 07 '17 07:06 guolinke

BTW, you may need to delete data.train.bin and data.validate.bin in all machines, then set save_binary=false and run it again.

guolinke avatar Jun 07 '17 07:06 guolinke

no error message, just 2 machines pending on Started training...,stack below: pstack ${process_id}, info below: Thread 2 (Thread 0x7f6c8e9c4700 (LWP 32881)): #0 0x00007f6d7c40eb32 in gomp_barrier_wait_end () from /usr/local/gcc/lib64/libgomp.so.1 #1 0x00007f6d7c40d36e in gomp_thread_start () from /usr/local/gcc/lib64/libgomp.so.1 #2 0x00000037be407a51 in start_thread () from /lib64/libpthread.so.0 #3 0x00000037be0e896d in clone () from /lib64/libc.so.6 Thread 1 (Thread 0x7f6d7c1ec780 (LWP 32804)): #0 0x00000037be40ed5c in send () from /lib64/libpthread.so.0 #1 0x00000000004adcec in LightGBM::Network::ReduceScatter(char*, int, int const*, int const*, char*, std::function<void ()(char const*, char*, int)> const&) () #2 0x00000000004af45b in LightGBM::DataParallelTreeLearner::FindBestThresholds() () #3 0x00000000004b3579 in LightGBM::SerialTreeLearner::Train(float const*, float const*) () #4 0x00000000004440e8 in LightGBM::GBDT::TrainOneIter(float const*, float const*, bool) () #5 0x0000000000427616 in LightGBM::Application::Train() () #6 0x0000000000426762 in main ()

hlee13 avatar Jun 07 '17 07:06 hlee13

@hlee13 , clean all the cache data in your working folder ( data.bin/ tree files), and try feature first.

data require you split your data into different slices.

chivee avatar Jun 07 '17 07:06 chivee

@hlee13 Did two machines both output following log (exact the same? )?

[LightGBM] [Warning] File data.train.bin existed, cannot save binary to it
[LightGBM] [Warning] File data.validate.bin existed, cannot save binary to it
[LightGBM] [Info] Total Bins 88115
[LightGBM] [Info] Number of data: 40240974, number of used features: 447

guolinke avatar Jun 07 '17 07:06 guolinke

all things work well, while tree_learner is feature.

hlee13 avatar Jun 07 '17 07:06 hlee13

machine0 output

[LightGBM] [Info] Finished loading parameters [LightGBM] [Info] Trying to bind port 12400... [LightGBM] [Info] Binding port 12400 succeeded [LightGBM] [Info] Listening... [LightGBM] [Warning] Connecting to rank 1 failed, waiting for 10000 milliseconds [LightGBM] [Info] Connected to rank 1 [LightGBM] [Info] Local rank: 0, total number of machines: 2 [LightGBM] [Info] Finished initializing network [LightGBM] [Warning] File data.train.bin existed, cannot save binary to it [LightGBM] [Warning] File data.validate.bin existed, cannot save binary to it [LightGBM] [Info] Finished loading data in 70.716128 seconds [LightGBM] [Info] Total Bins 88115 [LightGBM] [Info] Number of data: 40240974, number of used features: 447 [LightGBM] [Info] Finished initializing training [LightGBM] [Info] Started training...

machine1 output

[LightGBM] [Info] Finished loading parameters [LightGBM] [Info] Trying to bind port 12400... [LightGBM] [Info] Binding port 12400 succeeded [LightGBM] [Info] Listening... [LightGBM] [Info] Connected to rank 0 [LightGBM] [Info] Local rank: 1, total number of machines: 2 [LightGBM] [Info] Finished initializing network [LightGBM] [Warning] File data.train.bin existed, cannot save binary to it [LightGBM] [Warning] File data.validate.bin existed, cannot save binary to it [LightGBM] [Info] Finished loading data in 71.372698 seconds [LightGBM] [Info] Total Bins 88115 [LightGBM] [Info] Number of data: 40241026, number of used features: 447 [LightGBM] [Info] Finished initializing training [LightGBM] [Info] Started training...

hlee13 avatar Jun 07 '17 07:06 hlee13

@chivee different slices, should be randomly split original file into two slices, then distribute them respectively. slice0 -> machine0, slice1 -> machine1 ?

hlee13 avatar Jun 07 '17 07:06 hlee13

@hlee13

  1. if you pre-partition data, you need to set is_pre_partition=true.
  2. you also can put full data on all machines, and set is_pre_partition=false (default is false) .
[LightGBM] [Warning] File data.train.bin existed, cannot save binary to it
[LightGBM] [Warning] File data.validate.bin existed, cannot save binary to it

Did you try cleaning the data.train.bin and data.validate.bin ?

guolinke avatar Jun 07 '17 07:06 guolinke

@guolinke now I config is_pre_partition=false(default),and put full data on all machines。cleaning the data.train.bin and data.validate.bin, save_binary=false

still does not work。

I am not sure it will work well. while is_pre_partition= true, and different machines using different partition.

hlee13 avatar Jun 07 '17 07:06 hlee13

may application block on kernel call sk_stream_wait_memory,kernel socket buffer full. my full data about 100G

send() call sk_stream_wait_memory

Thread 1 (Thread 0x7f6d7c1ec780 (LWP 32804)): #0 0x00000037be40ed5c in send () from /lib64/libpthread.so.0 #1 0x00000000004adcec in LightGBM::Network::ReduceScatter(char*, int, int const*, int const*, char*, std::function<void ()(char const*, char*, int)> const&) () #2 0x00000000004af45b in LightGBM::DataParallelTreeLearner::FindBestThresholds() () #3 0x00000000004b3579 in LightGBM::SerialTreeLearner::Train(float const*, float const*) () #4 0x00000000004440e8 in LightGBM::GBDT::TrainOneIter(float const*, float const*, bool) () #5 0x0000000000427616 in LightGBM::Application::Train() () #6 0x0000000000426762 in main ()

hlee13 avatar Jun 07 '17 08:06 hlee13

@hlee13 I add some debug output in branch parallel-debug, can you try on it, and provide the running logs on all the two machines ?

guolinke avatar Jun 07 '17 08:06 guolinke

The communication size of that "send" is about 881,150 bytes, it will exceed the buffer size?

guolinke avatar Jun 07 '17 08:06 guolinke

machine0 output

[LightGBM] [Info] send to rank 1 with len 8 [LightGBM] [Info] recv from rank 1 with len 8 [LightGBM] [Info] send to rank 1 with len 4 [LightGBM] [Info] recv from rank 1 with len 4 [LightGBM] [Info] send to rank 1 with len 4 [LightGBM] [Info] recv from rank 1 with len 4 [LightGBM] [Info] send to rank 1 with len 4 [LightGBM] [Info] recv from rank 1 with len 4 [LightGBM] [Info] send to rank 1 with len 467325 [LightGBM] [Info] recv from rank 1 with len 467325 [LightGBM] [Info] Finished loading data in 332.915550 seconds [LightGBM] [Info] Total Bins 89147 [LightGBM] [Info] Number of data: 40240974, number of used features: 447 [LightGBM] [Info] Finished initializing training [LightGBM] [Info] Started training... [LightGBM] [Info] send to rank 1 with len 24 [LightGBM] [Info] recv from rank 1 with len 24 [LightGBM] [Info] block info: [LightGBM] [Info] 0 0 952224 [LightGBM] [Info] 1 952224 950064 [LightGBM] [Info] send to rank 1 with len 950064 [LightGBM] [Info] recv from rank 1 with len 952224

machine1 output

[LightGBM] [Info] Local rank: 1, total number of machines: 2 [LightGBM] [Info] Finished initializing network [LightGBM] [Info] send to rank 0 with len 4 [LightGBM] [Info] recv from rank 0 with len 4 [LightGBM] [Info] send to rank 0 with len 8 [LightGBM] [Info] recv from rank 0 with len 8 [LightGBM] [Info] send to rank 0 with len 4 [LightGBM] [Info] recv from rank 0 with len 4 [LightGBM] [Info] send to rank 0 with len 4 [LightGBM] [Info] recv from rank 0 with len 4 [LightGBM] [Info] send to rank 0 with len 4 [LightGBM] [Info] recv from rank 0 with len 4 [LightGBM] [Info] send to rank 0 with len 467325 [LightGBM] [Info] recv from rank 0 with len 467325 [LightGBM] [Info] Finished loading data in 197.631614 seconds [LightGBM] [Info] Total Bins 89147 [LightGBM] [Info] Number of data: 40241026, number of used features: 447 [LightGBM] [Info] Finished initializing training [LightGBM] [Info] Started training... [LightGBM] [Info] send to rank 0 with len 24 [LightGBM] [Info] recv from rank 0 with len 24 [LightGBM] [Info] block info: [LightGBM] [Info] 0 0 952224 [LightGBM] [Info] 1 952224 950064 [LightGBM] [Info] send to rank 0 with len 952224 [LightGBM] [Info] recv from rank 0 with len 950064

hlee13 avatar Jun 07 '17 08:06 hlee13

@guolinke could you mock 100G dataset, to debug this error, the problem gradually clear

hlee13 avatar Jun 07 '17 08:06 hlee13

@hlee13 From the output log, all the logic are correct. I think the problem is the default size of network stack is too small. I just reduce the setting of socket buffer in parallel-debug branch, you can try it again.

Or you can edit the net.core.wmem_max and net.core.rmem_max to a bigger value.

guolinke avatar Jun 07 '17 08:06 guolinke

@guolinke

sysctl output

net.core.wmem_max = 124928 net.core.rmem_max = 124928

can lightgbm config support limit the socket buffer

hlee13 avatar Jun 07 '17 08:06 hlee13

you can change it at : https://github.com/Microsoft/LightGBM/blob/master/src/network/socket_wrapper.hpp#L84

I just reduce it to 100k on master branch.

guolinke avatar Jun 07 '17 08:06 guolinke

@guolinke

machine1 output

[LightGBM] [Info] Finished loading parameters [LightGBM] [Fatal] Check failed: setsockopt(sockfd_, IPPROTO_TCP, TCP_NODELAY, reinterpret_cast<const char*>(&SocketConfig::kNoDelay), sizeof(SocketConfig::kNoDelay)) == 0 at /home/xiaoju/user/lihan/LightGBM/src/network/socket_wrapper.hpp, line 124 ...

hlee13 avatar Jun 07 '17 08:06 hlee13

@hlee13 just change it to warning in master branch.

guolinke avatar Jun 07 '17 09:06 guolinke