Skip to content

M1 Mac, nodejs GPU train time way longer than CPU #818

Closed
@joshstrike

Description

@joshstrike

A GIF or MEME to give some spice of the internet

What is wrong?

Running the basic XOR example, 10k interations. With brain.NeuralNetwork(), 46 milliseconds. With brain.NeuralNetworkGPU(), 14.6 seconds.

Where does it happen?

brain.js@2.0.0-beta.15. Node 18.3.0 running on the command line, Python 3.9.13 (don't think this matters?), M1 Macbook Pro (Max, 32 GPU cores).

How do we replicate the issue?

1 - Run the first XOR example in the Readme.md, (speed shown was attained using default config options, not passing a config to NeuralNetwork()).

Expected behavior (i.e. solution)

The GPU version... shouldn't be ...slower?

Version information

Nodejs:

Node 18.3.0

Browser:

N/A

Brain.js:

brain.js@2.0.0-beta.15

How important is this (1-5)?

5 if it's a bug, 0 if it's a mistake on my end.

Other Comments

This is my first time trying brain.js so it's quite possible I've just got something misconfigured. Love the project and the ease of use! The fact that on CPU that training took 46ms is hard to believe.

As a side note, I was unable to get the browser version to work at all from the CDN, it kept throwing js_gpu is undefined or something along those lines, then when I side-loaded gpu.js I got js_gpu.GPU is not a constructor. I'd rather use it in Node anyway...

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions