These are chat archives for uwhpsc-2016/uwhpsc-2016

6th
May 2016
Marisa Preciado
@Marisa67
May 06 2016 00:59
Hi, my test_homework2.py runs all the tests and passes them but at the end, I get

Ran 10 tests in 0.035s

OK

Makefile:28: recipe for target 'test' failed

make: * [test] Segmentation fault (core dumped)

petermcgill94
@petermcgill94
May 06 2016 01:00
This message was deleted
Marisa Preciado
@Marisa67
May 06 2016 01:00
I have no idea where to start looking for an error. Could you suggest something?
Hugh Krogh-Freeman
@hughkf
May 06 2016 01:04
@quantheory How do I determine if my code has a contiguous memory access pattern? I know this is a broad question, perhaps I can send you my code.
petermcgill94
@petermcgill94
May 06 2016 01:05
@quantheory is it possible to do a private chat with you?
anders34
@anders34
May 06 2016 01:06
I'm getting the segmentation fault. I've read the posts on the issues page about it, but in looking over my code, the advice on those pages hasn't helped. I've pushed my changes if you want to take a look at my code, I would appreciate it.
Sean Patrick Santos
@quantheory
May 06 2016 01:06
Sorry for the delay; I'm here!
@Marisa67 It might help if you can narrow down which function causes the issue. E.g. you can comment out the Jacobi tests, G-S tests, and so on to figure out which method has an error.
Nathan Schiele
@nschiele
May 06 2016 01:10
All of the functions in my Solvers work for smaller matrices, but fail at larger matrices. (solve upper/lower at 32x32, Jacobi at 13X13 and GS at 8x8). What is the maximum size matrix that will be tested? What could cause this to happen (anywhere specific I should look)?
Marisa Preciado
@Marisa67
May 06 2016 01:10
ok, will work on that.
Sean Patrick Santos
@quantheory
May 06 2016 01:10
@hughkf I think that I would try thinking about what your code is doing for some small size matrices (e.g. 3x3). Try to figure out what order elements are being accessed in the array.
Hugh Krogh-Freeman
@hughkf
May 06 2016 01:11
@quantheory I'll give that a try. Thanks!
petermcgill94
@petermcgill94
May 06 2016 01:11
@quantheory I was wondering is you could help me with a the Gauss Seidel method. Mine is diverging away from the answer and im getting a 'nan' when I test it, I have no idea why! Would you be able to take a look?
WalesJ
@WalesJ
May 06 2016 01:13
@quantheory I sent you a private message.
Cheng Dang
@chengdang
May 06 2016 01:13
@quantheory Hi Sean. I have a interesting issue. Each of the solvers I wrote passed the test if tested alone. But if I try to test all of them in one python program, there is segmentation errors.
@quantheory I just send you a private message, please let me know if you want to see part of the code.
Sean Patrick Santos
@quantheory
May 06 2016 01:15
One general thing I'd like to note for people who are getting strange errors, is to look at any warnings you get when you compile, and try to fix those.
Cheng Dang
@chengdang
May 06 2016 01:18
There is actually no warning when I compiled my code, that is why I'm puzzled
Sean Patrick Santos
@quantheory
May 06 2016 01:19
One more thing (also a generally common problem, not for any specific person). Look at your mat_mat and mat_vec and vec_norm functions. If you start using += operator on an array that you have not initialized to 0, remember to do that. An uninitialized array could contain random data, which might or might not be zeros.
Cheng Dang
@chengdang
May 06 2016 01:22
What would be a legit way to initialize an array to 0 ? Do we need to write a for loop to do so? It seems ARRAY[N] = {0.0} is not working
Sean Patrick Santos
@quantheory
May 06 2016 01:22
@chengdang Yes, the simplest way to do this is to write a short for loop.
Cheng Dang
@chengdang
May 06 2016 01:24
@quantheory It seems this rule applies to a lot of the functions then, I'll try this to test my code
Sean Patrick Santos
@quantheory
May 06 2016 01:24
@nschiele This issue may be relevant to you: uwhpsc-2016/homework2#19
Cheng Dang
@chengdang
May 06 2016 01:33
@quantheory I still got the same segmentation error even if i initialize the functions
  • argument
@quantheory Would you have time to take a look at my code?
bplilley
@bplilley
May 06 2016 01:34
@quantheory would it be possible to do a private chat?
Sean Patrick Santos
@quantheory
May 06 2016 01:35
@chengdang Can you push the fixed version to GitHub?
@bplilley Sure.
Nathan Schiele
@nschiele
May 06 2016 01:36
@quantheory Yeah - I figured out why it was breaking for solve upper/solve lower (the random testing issue). I still can't find why my Jacobi/Gauss Seidel won't solve correctly. If I lower the error bound on my test python to 1e-7, it'll work for matrices that are much larger
Hugh Krogh-Freeman
@hughkf
May 06 2016 01:39
@quantheory I am wondering about "Does this function have a contiguous memory access pattern?" from HW2. Is it asking if all memory accesses are contiguous? In my code, most, but not all, are contiguous.
Sean Patrick Santos
@quantheory
May 06 2016 01:40
@hughkf Most is the standard here. It's not possible for most cases to get all of them to be contiguous (except for simple operations, like adding two matrices).
Cheng Dang
@chengdang
May 06 2016 01:40
@quantheory just did. Thank you!
Nathan Schiele
@nschiele
May 06 2016 01:41
@quantheory I tried change the error bound on my python test to 2e-8 and I'm not finding any problems. It seems that my errors are all around 1.2e-8, and I'm not sure why they are just slightly higher than 1e-8. Any ideas?
Sean Patrick Santos
@quantheory
May 06 2016 01:44
@nschiele Thinking about it (I have a lot of people messaging me, so I'm trying to get to everyone!)
@chengdang I don't know if it's really the issue, but make sure that your xdiff arrays are properly initialized. Even if you're just filling it in with big numbers. It would help me to try running the code through Valgrind even if that's not the problem.
Cheng Dang
@chengdang
May 06 2016 01:47
@quantheory sure! Thank you. I'll update it now
@quantheory I just pushed the changes. Before that I tested the code, and the segmentation error remains.
Sean Patrick Santos
@quantheory
May 06 2016 01:52
@nschiele Can you push whatever test you're using to GitHub so I can look at it myself?
Nathan Schiele
@nschiele
May 06 2016 01:53
@quantheory I put all my tests in test_homework2.py, and they've been pushed to my GitHub repo (currently using 2e-8 as my error bounds for GS and Jacobi)
Sean Patrick Santos
@quantheory
May 06 2016 01:54
@chengdang You are setting the pointer xk to out, and then freeing it. What that means is that you are "leaking" the memory that was allocated in xk, and also deallocating the memory that's supposed to hold your result, which is a problem. You probably want to copy the data (again, write a for loop) from xk to out, not reassign the pointer xk.
anders34
@anders34
May 06 2016 01:55
Just wanted to make sure my question didn't get skipped. Here's what I said: I'm getting the segmentation fault. I've read the posts on the issues page about it, but in looking over my code, the advice on those pages hasn't helped. I've pushed my changes if you want to take a look at my code, I would appreciate it.
Cheng Dang
@chengdang
May 06 2016 01:56
This message was deleted
Sean Patrick Santos
@quantheory
May 06 2016 01:58
@nschiele It looks to me like your jacobi_step is using xkp1 before it is initialized? At least the first time it is called?
Cheng Dang
@chengdang
May 06 2016 01:59
I replaced the xk = out with the following code:
    for (int k=1; k<N; ++k)
        xk[k]  = out[k];
Sean Patrick Santos
@quantheory
May 06 2016 01:59
@chengdang You probably want to start at 0 rather than 1?
Cheng Dang
@chengdang
May 06 2016 01:59
nice catch!
Sean Patrick Santos
@quantheory
May 06 2016 02:00
@anders34 I'm still seeing quite a few warnings pop up when compiling your code. I think that it's likely that those are related.
anders34
@anders34
May 06 2016 02:01
how exactly do you just compile it?
Sean Patrick Santos
@quantheory
May 06 2016 02:01

For instance, you have this line:

while (vec_norm(out - xk, N) > epsilon) {

However, out - xk doesn't make sense; you are subtracting two pointers, which doesn't really mean anything. What you want to do instead is call vec_sub if you want to subtract two array values.

Cheng Dang
@chengdang
May 06 2016 02:01
@quantheory Running like a charm smile: Thank you!
Sean Patrick Santos
@quantheory
May 06 2016 02:01
@anders34 make clean, then make
Sean Patrick Santos
@quantheory
May 06 2016 02:11
Any other issues? I'm going to stop office hours momentarily.
jdstead
@jdstead
May 06 2016 02:13
i cannot get make to work
Nathan Schiele
@nschiele
May 06 2016 02:13
I still have my same issue. If I lower epsilon in testing then I won't have any issues. Can I assume that I have a working solution?
jdstead
@jdstead
May 06 2016 02:13
i try to compile linalg and solvers, they can't find the header files.
Sean Patrick Santos
@quantheory
May 06 2016 02:14
@nschiele Can you push your newer code to GitHub?
Nathan Schiele
@nschiele
May 06 2016 02:16
@quantheory My newest code is in GitHub. All I changed was lowering epsilon in test_homework2.py (I put it at 1e-15)
Sean Patrick Santos
@quantheory
May 06 2016 02:20
You still have the issue I mentioned before. jacobi_step is using xkp1 before it is set. In fact it doesn't use xk at all, so I don't know how it could work?
nicksmithc102
@nicksmithc102
May 06 2016 02:25
I'm noticing that, past a certain point, no matter how small I make epsilon, my methods converge in the exact same number of iterations. Any reason why that's the case?
I mean, converge at the same number they do when epsilon = 1e-12 or 1e-30
Sean Patrick Santos
@quantheory
May 06 2016 02:27
@nicksmithc102 Probably floating-point precision? Possibly depending on the exact system and its size, 1.e-12 may be hitting the point where, due to floating-point precision issues, an iteration of Jacobi or G-S is no longer changing x.
nicksmithc102
@nicksmithc102
May 06 2016 02:28
I see.
Thanks!
Sean Patrick Santos
@quantheory
May 06 2016 02:28
So then the difference between xk and xkp1 is going to be 0, which is always smaller than any positive epsilon.
Nathan Schiele
@nschiele
May 06 2016 02:31
@quantheory So I fixed the error you mentioned. I have no idea how it worked before, and I seem to have the exact same issue now (works for smaller values of epsilon).
Yi Zheng
@qpskcn1
May 06 2016 02:31
Hi Sean, I am confusing about how can we get the expected number of iteration for both jacobi and gauss seidel.
Sean Patrick Santos
@quantheory
May 06 2016 02:35
@nschiele If you're using the tests in your test_homework2.py, those are using matrix sizes way too large for a random matrix to be well-conditioned. Use a non-random matrix, or much smaller matrices (e.g. 10x10).
@qpskcn1 I don't quite understand the question.
Yi Zheng
@qpskcn1
May 06 2016 02:37
"Does jacobi return the expected number of iterations for this problem for various n? Your output will be compared directly with the output from a correct implementation." Is there anyway we can test the expected number of iterations in our own test?
Sean Patrick Santos
@quantheory
May 06 2016 02:39
Oh, the number of iterations should be returned by jacobi. So at the end of the function, you should do return count; (or whatever you call the variable that records the number of iterations).
Yi Zheng
@qpskcn1
May 06 2016 02:40
I see, but should there be a correct number of iterations that we could compare?
Sean Patrick Santos
@quantheory
May 06 2016 02:43
Hmm, I see your point. If your code from Homework 1 works, that would be something that you could compare against (or the one in the solution repo, if you aren't sure about your own code).
Yi Zheng
@qpskcn1
May 06 2016 02:45
Got it, thanks
dawong94
@dawong94
May 06 2016 06:39
Hey, I'm in trouble with downloading notebook as pdf. Do you guys have any ideas how to do it?
it said nbconvert failed: PDF creating failed
Yi Zheng
@qpskcn1
May 06 2016 06:48
@dawong94 I got the same error before, and I split the report into several part to find which part causes the error
And my error was caused by a comma in Chinese. I think the compiler just cannot recognize it.
dawong94
@dawong94
May 06 2016 06:52
ill try to find out
thanks man
dawong94
@dawong94
May 06 2016 07:00
@qpskcn1 I just fixed my problem which was caused by an unidentified sign
@qpskcn1 thanks again
Matt
@mostberg1
May 06 2016 13:52
Is anyone else having trouble with sage math cloud, it won't start my project
Matt
@mostberg1
May 06 2016 14:30
Anyone?
bplilley
@bplilley
May 06 2016 15:26
Using it now. Seems fine
anders34
@anders34
May 06 2016 16:48
I know I'm asking this before office hours start, but I have class, so I wanted to make sure I asked my question. I'm still a segmentation fault and I'm not sure why. I think it might be coming from gauss seidel, but I'm not sure. I've pushed my changes, if you wouldn't mind taking a look and see if you can figure out why. I would really appreciate it. Thanks!
WalesJ
@WalesJ
May 06 2016 17:45
Not sure if anyone could help me without looking at my code, but my gauss is returning an empty vector and my jacobi is getting stuck somewhere in the function and won't return anything.
mvelegar
@mvelegar
May 06 2016 18:01
Starting my OH now, helping with one issue currently so please give me a few minutes
@WalesJ have replied to you in your issues thread
@anders34 will be looking at your code in a few minutes
Nathan Schiele
@nschiele
May 06 2016 18:08
@mvelegar My Jacobi won't work for matrices larger than 4x4 and my GS won't work for matrices between 10x10 and 13x13, and for matrices larger than 18x18. If I divide epsilon by 10, it works for everything. No idea why this is the case. Any ideas?
Marisa Preciado
@Marisa67
May 06 2016 18:08
Hi Meghana, I am copying my markdown cell where I have my code into my word document (in which I have all my answers) but it looks awful, any tips?
natwall27
@natwall27
May 06 2016 18:11
@mvelegar , I am wondering if you could help me figure out why time_gauss_seidel is not working for me when I run 'make test', when you have availability.
mvelegar
@mvelegar
May 06 2016 18:11
@Marisa67 have never used word for code blocks, did you google for tips?
@Marisa67 I will be grading your report more for content than how your code looks in it, if it helps
@nschiele by doesn't work I am assuming it doesn't pass 'selfassertalmostequal'?
natwall27
@natwall27
May 06 2016 18:16
@mvelegar , nevermind, I figured it out.
mvelegar
@mvelegar
May 06 2016 18:16
@natwall27 haha you just said that when i finished typing a longish response
could you close any issues you opened?
natwall27
@natwall27
May 06 2016 18:17
yes, I will do that.
thank you, @mvelegar !
Nathan Schiele
@nschiele
May 06 2016 18:18
@mvelegar It doesn't pass 'self.assertLess(error, 1e-8)' where error is the norm of my output solution minus scipy_solve. I'm trying putting in almost equal now.
mvelegar
@mvelegar
May 06 2016 18:19
@nschiele never mind
bplilley
@bplilley
May 06 2016 18:19
@mvelegar , would you mind taking a look at my jacobi? I've already pushed it. I'm getting really large iteration counts (sometimes >1000) and my final x has been something like the following: [-inf nan nan]
mvelegar
@mvelegar
May 06 2016 18:20
@nschiele I think it may be either (1) epsilon needs to be lower to give you a good output value for larger matrices
which is completely OK.
(2) may be a very subtle bug, but I highly doubt that since making epsilon smaller gives you a correct result to 8 digits
@bplilley ok will look at it now. everyone, brb after looking at this code
Nathan Schiele
@nschiele
May 06 2016 18:22
@mvelegar So it's alright that I lower epsilon for my submission? Will that throw off my Jacobi/GS iteration counts?
mvelegar
@mvelegar
May 06 2016 18:23
@nschiele I'll be testing your code with my own set epsilon value, since this will effect the number of iterations
as in I am picking different epsilons and will check how many iterations your algorithm took
Marisa Preciado
@Marisa67
May 06 2016 18:25
Thanks!
natwall27
@natwall27
May 06 2016 18:31
@mvelegar , is it ok to create a file named "report" in our homework repository, rather than a directory, for report.pdf? I have not figured out how to create a directory in the repository yet.
mvelegar
@mvelegar
May 06 2016 18:33
mkdir report
cd report
natwall27
@natwall27
May 06 2016 18:35
I that in git shell, and I see it listed, but then I was not sure how to push it to the github repository, as the git status says there is nothing to commit. Should I be doing all my terminal work in SMC?
anders34
@anders34
May 06 2016 18:36
@mvelegar , have you gotten a chance to look at my code?
mvelegar
@mvelegar
May 06 2016 18:36
please put it under this directory
@anders34 not yet, you are next in line
natwall27
@natwall27
May 06 2016 18:37
ok, thank you, @mvelegar .
bplilley
@bplilley
May 06 2016 18:39
so i already realized one thing: for initialing D and LU to zeros I had do until i< NN-1 instead of i<NN. I fixed this but am still getting the same result
mvelegar
@mvelegar
May 06 2016 18:40
ok
@bplilley did you initialize these: LUx, diff, bLUx?
bplilley
@bplilley
May 06 2016 18:46
no, so just make them all zeros?
mvelegar
@mvelegar
May 06 2016 18:47
always, especially using +=
@anders34 you are up next
bplilley
@bplilley
May 06 2016 18:51
Hmm, unfortunately i'm getting the same result
mvelegar
@mvelegar
May 06 2016 18:52
@anders34 have you tested your code for gauss seidel using any C code?
anders34
@anders34
May 06 2016 18:53
Umm, no I guess not. I've just used the test_homework2.py
mvelegar
@mvelegar
May 06 2016 18:53
@anders34 ok hold on
natwall27
@natwall27
May 06 2016 18:58
I am getting an error when I try to commit changes, and it suggests I try "git pull" before pushing again. Is it ok to "git pull" again?
mvelegar
@mvelegar
May 06 2016 18:59
@anders34 i used the debugger and the error is tracing back to the free statements in your gauss seidel code
working through it
OH are officially over. I will be trying to resolve @anders34 , @bplilley and @WalesJ issues for the next half an hour
@natwall27 one sec
@natwall27 save a copy of the entire directory somewhere else before attempting git pull
natwall27
@natwall27
May 06 2016 19:04
Ok. Thank you.
mvelegar
@mvelegar
May 06 2016 19:06
@natwall27 doing git pull on a repo is a very ordinary thing when you have multiple people working on a project, or one person has several clones they are working with (one at work, one at home, etc). If you only worked with one copy and you are the only one working on it, so this should not happen. You might see more errors because git will try to merge your local changes with the latest “pull”. There are some issues on the homework2 board that might help
OK @anders34 will work on your issue first
natwall27
@natwall27
May 06 2016 19:07
Ok, thank you @mvelegar . I think it's because I have a copy on my computer. I downloaded a GitHub program and Git Shell. It was confusing, so I switched to SMC.
mvelegar
@mvelegar
May 06 2016 19:20
I am still here, tracing the seg fault for @anders34 is taking some time
bplilley
@bplilley
May 06 2016 19:20
OK
mvelegar
@mvelegar
May 06 2016 19:23
@anders34 valgrind to the rescue! it was a memory leak issue
solvers.c line 151
anders34
@anders34
May 06 2016 19:24
So what's wrong with that line?
mvelegar
@mvelegar
May 06 2016 19:24
T is size N
anders34
@anders34
May 06 2016 19:24
oh, yeah, just saw that
mvelegar
@mvelegar
May 06 2016 19:24
code says double T = (double )malloc(N*sizeof(double));
anders34
@anders34
May 06 2016 19:25
thank you so much!
mvelegar
@mvelegar
May 06 2016 19:26
@bplilley you are up now
bplilley
@bplilley
May 06 2016 19:26
sounds good!
mvelegar
@mvelegar
May 06 2016 19:26
please push your latest code to repo
let me know when it's done
bplilley
@bplilley
May 06 2016 19:28
should be there now
mvelegar
@mvelegar
May 06 2016 19:31
ok 5 mins and i'll look at it. just one guy left ahead of you in a Private chat
bplilley
@bplilley
May 06 2016 19:31
got it
Hugh Krogh-Freeman
@hughkf
May 06 2016 19:45
Is anyone getting a seg fault occasionally from running Gauss-Seidel?
bplilley
@bplilley
May 06 2016 19:47
@mvelegar i wonder if it's something with my solve lower/upper triangulars. When i switched it from lower to upper in my jacobi it solves in 2 iterations rather than 300+
mvelegar
@mvelegar
May 06 2016 19:48
hmm ok working with your code now
one sec
bplilley
@bplilley
May 06 2016 19:49
i would think they'd be the same though since only the diagonal is non-zero
mvelegar
@mvelegar
May 06 2016 20:01
@bplilley your error keeps growing instead of decreasing
bplilley
@bplilley
May 06 2016 20:02
hmm, OK
mvelegar
@mvelegar
May 06 2016 20:02
iteration 1 error = 6.758624
iteration 2 error = 23.899221
iteration 3 error = 33.980835
iteration 4 error = 116.590660
iteration 5 error = 170.897995
iteration 6 error = 569.345154
iteration 7 error = 858.973328
iteration 8 error = 2783.169434
iteration 9 error = 4314.575195
iteration 10 error = 13618.531250
iteration 11 error = 21657.089844
iteration 12 error = 66699.476562
iteration 13 error = 108633.179688
iteration 14 error = 326957.906250
iteration 15 error = 544537.500000
iteration 16 error = 1604040.000000
iteration 17 error = 2727740.000000
iteration 18 error = 7875353.000000
and so on
you need to debug why this is happening (it's a logic error)
print out your values like I have and you should be able to figure it out
good luck!
bplilley
@bplilley
May 06 2016 20:04
how do you print them like that?
mvelegar
@mvelegar
May 06 2016 20:04
put this at the end of his while loop: printf("iteration %d error = %f\n", num_iter, (float)error);
you can print other values too
ok signing off. good luck to everyone
Marisa Preciado
@Marisa67
May 06 2016 20:31
git log
Yi Zheng
@qpskcn1
May 06 2016 21:55
This message was deleted