brain.js icon indicating copy to clipboard operation
brain.js copied to clipboard

trainasync run on single thread

Open Edig opened this issue 3 years ago • 0 comments

What is wrong?

I test the trainasync and as far I check, it only run on single thread

Where does it happen?

net.trainAsync

Version information

Nodejs:

v16.14.2

Brain.js:

2.0.0-beta.15

I check in resourse monitor the # of thread that node run when i train the net in a single thread or async with 12 thread. Both start running on 16 threads and then go down to 12, sometimes grew to 13. What I'm doing wrong?

//Generate NN
    const net = new brain.NeuralNetwork({
        hiddenLayers: hiddenLayers
        activation: 'sigmoid'

    });

    console.log(`${hiddenLayers} Error: ${errorThresh}  Range Ticks (15m): ${range_ticks}`)

    net.trainAsync(trainingData, {
         parallel: {
             threads: 12,
             partitionSize: 3200,
         },
        errorThresh: errorThresh,
        log: true,
        logPeriod: 10,
        iterations: 30000,
        // learningRate: 0.001
    }).then((res) => {
        console.log(res)
        let save_data = {
            brain: net.toJSON()
        }
}).catch((err) => { console.log('Error', err) })

Also I try to run on GPU and CPU and GPU never get any work done.

Note: Resource monitor says that node its only consuming 8% of the CPU

image

CPU: Intel(R) Core(TM) i7-7800X CPU @ 3.50GHz 3.50 GHz GPU: 1080 TI

Edig avatar May 31 '22 04:05 Edig