-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Segmentation fault when using FOR loops on matrices #579
Comments
... Matjaž,
tale report za GIT si kar piši v časovnice, ta razvijana tehnologija je glavni poudarek projekta. Lepo.
Trenutno vidim, da je status tega #579 " No one assigned ".
Ko bo kak komentar na ta #579, potem načeloma sam sebe potem dodeliš in ponudiš rešitev v obliki PR.
Morda bo jutri Patrick na sestanku in ga lahko to vprašaš. Lahko pa, da bo Patrick spet sam rešil (ali pa Mark ali kdo drug ali pa kdo že na tem dela in je podvojeno).
Lep pozdrav.
…--
izr. prof. dr. Aleš Zamuda | Izredni profesor | https://aleszamuda.si
Univerza v Mariboru (UM) | Fakulteta za elektrotehniko, računalništvo in informatiko (FERI)
Inštitut za računalništvo | Laboratorij za računalniške arhitekture in jezike
Koroška cesta 46, 2000 Maribor | Telefon: +386 2220 7404
IEEE Senior Member (SMIEEE) | član: IEEE CIS, OES, GRSS | ACM | ACM SIGEVO
IEEE CIS Task Force on Benchmarking Chair https://cmte.ieee.org/cis-benchmarking/
IEEE Slovenia CIS Chapter Chair https://r8.ieee.org/slovenia-cis/
ACM GECCO 2022 organizator: Virtualisation Chair, https://gecco-2022.sigevo.org
Vodja projekta na UM FERI (EU H2020 RIA konzorcij): DAPHNE https://daphne-eu.eu/
E-mail: ***@***.***, ***@***.***, ***@***.***
Na dan sreda, 02. avgust 2023 ob 20:24:34 WEST ste divjakm zapisali:
Hello! I noticed I sometimes get a segmentation fault error when I use FOR loops for copying matrix data, but no error if I copy data using indexing.
The example code below works for N = 100 in both versions: with FOR loops (ver = 1) and indexing (ver = 2).
But for N = 1000 and ver = 1 I get a segmentation fault.
If I use ver = 2, then it works even for very large matrices.
```
// parameters:
ver = 1; // concatenate version: 1-slow, 2-fast
N = 1000; // matrix size
// create 2 matrices
Y1 = as.matrix<f64>(fill(100, N, 10));
Y2 = as.matrix<f64>(fill(200, N, 10));
nrowY1 = nrow (Y1);
ncolY1 = ncol (Y1);
nrowY2 = nrow (Y2);
ncolY2 = ncol (Y2);
print ("Y1 size: " + as.scalar(nrowY1) + " x " + as.scalar(ncolY1));
print ("Y2 size: " + as.scalar(nrowY2) + " x " + as.scalar(ncolY2));
// initialize matrix for concatenated signals
Y = as.matrix<f64> (fill (0, nrowY1+nrowY2, ncolY1));
// concatenate matrices Y1 and Y2
if (ver == 1)
{
// concatenate 1: with FOR loops
for (c in 0 : ncolY1 - 1)
{
for (r in 0 : nrowY1 - 1)
Y[r,c] = Y1[r,c];
}
for (c in 0 : ncolY2 - 1)
{
for (r in 0 : nrowY2 - 1)
Y[nrowY1+r,c] = Y2[r,c];
}
}
else
{
// concatenate 2: assign submatrix
Y[0:nrowY1, 0:ncolY1] = Y1[,];
Y[nrowY1:nrowY1+nrowY2, 0:ncolY2] = Y2[,];
}
nrowY = nrow (Y);
ncolY = ncol (Y);
print ("Y size: " + as.scalar(nrowY) + " x " + as.scalar(ncolY));
```
|
Adding my translation, below. :.)
.. Matjaž,
write this report for GIT in your timelines, this developed technology is the main focus of the project. Nice.
Currently I see that the status of this #579 is " No one assigned ".
When there is a comment on this #579, then in principle you assign yourself and offer a solution in the form of a PR.
Maybe Patrick will be in a meeting tomorrow and you can ask him that. Or maybe Patrick will solve it himself again (or Mark or someone else or someone is already working on it and it's duplicated).
Best Regards.
|
Hi! Off the top of my head, I'd say this could be related to (or be the same as) issue #77. Regards, Mark |
Hi! Thank you for a very quick answer. It does seem it could be related to issue #77. Unfortunately, I would like to loop for approx. 2.5 million times... :) I'll test a few other looping variants, hopefully I can find a workaround. |
To sort the eigen vectors correctly according to the eigen values, a transpose was missing.
Hi! I tested this thoroughly and it works now. It seems it was fixed, so I'll close this issue. Thank you! |
Closing... |
Hello! I noticed I sometimes get a segmentation fault error when I use FOR loops for copying matrix data, but no error if I copy data using indexing.
The example code below works for N = 100 in both versions: with FOR loops (ver = 1) and indexing (ver = 2).
But for N = 1000 and ver = 1 I get a segmentation fault.
If I use ver = 2, then it works even for very large matrices.
The text was updated successfully, but these errors were encountered: