我有带NVIDIA gpu的电脑。我已经安装了OpenBLAS。我正在尝试使用gensim的word2vec实现来训练单词向量。我已设定工人数= 4。但是当我运行top命令来查看CPU使用情况时。它只显示100%。这是否意味着只使用了一个核心?我的程序没有显示任何加速。
我的代码段是:
import gensim
import time
import numpy
class MySentences(object):
def __init__(self, dirname):
self.dirname = dirname
#called when Word2Vec is called
def __iter__(self):
for fname in os.listdir(self.dirname):
for line in open(os.path.join(self.dirname, fname)):
yield line.split()
sentences=MySentences("/home/lalchand/NewdatasetforAssgn2/tfidf/spam")
start = time.time()
model = gensim.models.Word2Vec(sentences, min_count=1,iter=5,workers=4)
print(model.syn0.shape)