LLVM ERROR: out of memory

WSL Ubuntu user with 16GB ram. Getting this error using Tensors:
LLVM ERROR: out of memory
Allocation failed
[76641:76641:20240928,125448.725259:ERROR file_io_posix.cc:144] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq: No such file or directory (2)
[76641:76641:20240928,125448.725342:ERROR file_io_posix.cc:144] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq: No such file or directory (2)
Please submit a bug report to https://github.com/modularml/mojo/issues and include the crash backtrace along with all the relevant source codes.
Stack dump:
0. Program arguments: mojo run tst.mojo
[76641:76645:20240928,125448.726441:ERROR directory_reader_posix.cc:42] opendir /home/cdjones2005/.modular/crashdb/attachments/d64fa270-91ca-4f99-aef6-873b441805f4: No such file or directory (2)
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0 mojo 0x000056044ad0d438
1 mojo 0x000056044ad0b25e
2 mojo 0x000056044ad0dacd
3 libc.so.6 0x00007fa62fce4520
4 libc.so.6 0x00007fa62fd389fc pthread_kill + 300
5 libc.so.6 0x00007fa62fce4476 raise + 22
6 libc.so.6 0x00007fa62fcca7f3 abort + 211
7 mojo 0x000056044acaa688
8 mojo 0x000056044acaa6c2
9 mojo 0x000056044c4a9af5
10 mojo 0x000056044d0fca42
11 mojo 0x000056044d0fcd18
12 mojo 0x000056044d0fb0ad
13 libKGENCompilerRTShared.so.19.0git 0x00007fa61fd97ead KGEN_CompilerRT_AlignedAlloc + 125
14 libKGENCompilerRTShared.so.19.0git 0x00007fa5d800c7ed KGEN_CompilerRT_AlignedAlloc + 18446744072504166845
mojo crashed!
Please file a bug report.
Aborted
LLVM ERROR: out of memory
Allocation failed
[76641:76641:20240928,125448.725259:ERROR file_io_posix.cc:144] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq: No such file or directory (2)
[76641:76641:20240928,125448.725342:ERROR file_io_posix.cc:144] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq: No such file or directory (2)
Please submit a bug report to https://github.com/modularml/mojo/issues and include the crash backtrace along with all the relevant source codes.
Stack dump:
0. Program arguments: mojo run tst.mojo
[76641:76645:20240928,125448.726441:ERROR directory_reader_posix.cc:42] opendir /home/cdjones2005/.modular/crashdb/attachments/d64fa270-91ca-4f99-aef6-873b441805f4: No such file or directory (2)
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0 mojo 0x000056044ad0d438
1 mojo 0x000056044ad0b25e
2 mojo 0x000056044ad0dacd
3 libc.so.6 0x00007fa62fce4520
4 libc.so.6 0x00007fa62fd389fc pthread_kill + 300
5 libc.so.6 0x00007fa62fce4476 raise + 22
6 libc.so.6 0x00007fa62fcca7f3 abort + 211
7 mojo 0x000056044acaa688
8 mojo 0x000056044acaa6c2
9 mojo 0x000056044c4a9af5
10 mojo 0x000056044d0fca42
11 mojo 0x000056044d0fcd18
12 mojo 0x000056044d0fb0ad
13 libKGENCompilerRTShared.so.19.0git 0x00007fa61fd97ead KGEN_CompilerRT_AlignedAlloc + 125
14 libKGENCompilerRTShared.so.19.0git 0x00007fa5d800c7ed KGEN_CompilerRT_AlignedAlloc + 18446744072504166845
mojo crashed!
Please file a bug report.
Aborted
1 Reply
Cdjones
Cdjones3w ago
Been trying to get a simple program working that uses Tensors of around size 10,000 x 784 float 32 elements. Whenever the program is run, it returns the LLVM out of memory error. Have tried to check if there are any memory leaks in code and even scaling down the Tensor sizes but it doesn't seem to change the output. Any help on this would be greatly appreciated. This is the github link for full code: https://github.com/mehta302/SimpleNN Program:
from tensor import Tensor, TensorShape
from random import seed
from structured.strd.utils import matmul, load_csv, tensor_transpose, copy, add_bias
from structured.strd.nn import softmax, get_accuracy, get_predictions
alias type: DType = DType.float32
alias n: Int = 784
alias m_test: Int = 10000

fn main() raises -> None:
var test_data: Tensor[type] = tensor_transpose[type, 0, 1](load_csv(
"./structured/datasets/MNIST_CSV/mnist_test.csv"
))
var Y: Tensor[type] = copy[type](TensorShape(1, m_test), test_data, 0)
var X: Tensor[type] = copy[type, 255](TensorShape(n, m_test), test_data, m_test)

seed()
var W1: Tensor[type] = Tensor[type].randn(TensorShape(10, n), 0, 0.25).clip(-0.5, 0.5)
var b1: Tensor[type] = Tensor[type].randn(TensorShape(10, 1), 0, 0.25).clip(-0.5, 0.5)
var W2: Tensor[type] = Tensor[type].randn(TensorShape(10, 10), 0, 0.25).clip(-0.5, 0.5)
var b2: Tensor[type] = Tensor[type].randn(TensorShape(10, 1), 0, 0.25).clip(-0.5, 0.5)

var Z1: Tensor[type] = add_bias[type](matmul[type](W1, X), b1)
var A1: Tensor[type] = Z1.clip(0, Scalar[type].MAX)
var A2: Tensor[type] = softmax[type](add_bias[type](matmul[type](W2, A1), b2))

print(get_predictions(A2))
from tensor import Tensor, TensorShape
from random import seed
from structured.strd.utils import matmul, load_csv, tensor_transpose, copy, add_bias
from structured.strd.nn import softmax, get_accuracy, get_predictions
alias type: DType = DType.float32
alias n: Int = 784
alias m_test: Int = 10000

fn main() raises -> None:
var test_data: Tensor[type] = tensor_transpose[type, 0, 1](load_csv(
"./structured/datasets/MNIST_CSV/mnist_test.csv"
))
var Y: Tensor[type] = copy[type](TensorShape(1, m_test), test_data, 0)
var X: Tensor[type] = copy[type, 255](TensorShape(n, m_test), test_data, m_test)

seed()
var W1: Tensor[type] = Tensor[type].randn(TensorShape(10, n), 0, 0.25).clip(-0.5, 0.5)
var b1: Tensor[type] = Tensor[type].randn(TensorShape(10, 1), 0, 0.25).clip(-0.5, 0.5)
var W2: Tensor[type] = Tensor[type].randn(TensorShape(10, 10), 0, 0.25).clip(-0.5, 0.5)
var b2: Tensor[type] = Tensor[type].randn(TensorShape(10, 1), 0, 0.25).clip(-0.5, 0.5)

var Z1: Tensor[type] = add_bias[type](matmul[type](W1, X), b1)
var A1: Tensor[type] = Z1.clip(0, Scalar[type].MAX)
var A2: Tensor[type] = softmax[type](add_bias[type](matmul[type](W2, A1), b2))

print(get_predictions(A2))
GitHub
GitHub - mehta302/SimpleNN: A neural network for predicting handwri...
A neural network for predicting handwritted digits made from scratch in pure mojo - mehta302/SimpleNN
Want results from more Discord servers?
Add your server