Skip to content

Commit

Permalink
feat: auto detect CPU core numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
howl-anderson committed Mar 9, 2020
1 parent 0c2db17 commit 3db4160
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
5 changes: 4 additions & 1 deletion compute_brown_cluster.bash
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#!/bin/bash

third-part/brown-cluster/wcluster --text WORDS.txt --c 1000 --threads 39
cpu_count=`nproc --all`
process_count=$(expr $cpu_count - 1)

./third-part/brown-cluster/wcluster --text WORDS.txt --c 1000 --threads ${process_count}
6 changes: 4 additions & 2 deletions compute_plain_word_vec.bash
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/bin/bash

# TODO: process number shoud auto compute
python ./spacy-dev-resources/training/plain_word_vectors.py -i 200 -n 6 ../chinese-wikipedia-corpus-creator/token_cleaned_plain_files WORDS_VECS.txt
cpu_count=`nproc --all`
process_count=$(expr $cpu_count - 1)

python ./spacy-dev-resources/training/plain_word_vectors.py -i 200 -n ${process_count} ../chinese-wikipedia-corpus-creator/token_cleaned_plain_files WORDS_VECS.txt
5 changes: 4 additions & 1 deletion compute_words_freq.bash
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#!/bin/bash

python ./spacy-dev-resources/training/plain_word_freqs.py -n 8 token_cleaned_plain_files WORDS_FREQ.txt
cpu_count=`nproc --all`
process_count=$(expr $cpu_count - 1)

python ./spacy-dev-resources/training/plain_word_freqs.py -n ${process_count} token_cleaned_plain_files WORDS_FREQ.txt

0 comments on commit 3db4160

Please sign in to comment.