LCP
LCP

Reputation: 71

word vectors using gensim's word2vec implementation and GPU does not show any speed-up

I have PC with NVIDIA gpu. I have installed OpenBLAS. I am trying to train word vectors using gensim's word2vec implementation. I have set number of workers =4. But when I run top command to see CPU usage. It is showing only 100%. Does it mean only one core is utilised? And my program does not show any speed-up.

My code snippet is:

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)

Upvotes: 1

Views: 950

Answers (1)

Kamil Sindi
Kamil Sindi

Reputation: 22822

Gensim does not currently support using GPUs: https://github.com/RaRe-Technologies/gensim/issues/449

Upvotes: 1

Related Questions