dilevin / computer-graphics-mass-spring-systems

Computer Graphics Assignment – Mass Spring Systems
1 stars 3 forks source link

Sparse skirt takes a while #2

Open msnhao opened 4 years ago

msnhao commented 4 years ago

Is skirt.json supposed to take ~17s per frame? Dense doesn't even start so precompute is definitely faster but I'm wondering if a step should take this long. Also, flag takes ~7s to update.

abhimadan commented 4 years ago

Did you compile your code in release mode?

msnhao commented 4 years ago

image I'm on windows using visual studio. I just have to set this to make it be in release mode right?

msnhao commented 4 years ago

I'm wondering if it's how I calculate my d matrix. I go through each row of d and normalize it individually, then multiply by the length of the resting edge.

abhimadan commented 4 years ago

A past issue was that a student didn't store their matrices and vectors in variables before passing them to the prefactorization object. It seems innocuous but Eigen since uses lazy evaluation, it won't evaluate an expression until it needs one of the values, and since LLT is happy to accept this intermediary object, it will evaluate the entire expression every time it needs an entry from it. But, if you store it in a variable first, Eigen will evaluate the expression and you won't have this problem.

msnhao commented 4 years ago

Shouldn't be the problem for me. I'm storing the calculation into a variable before doing prefactorization.solve(var)

abhimadan commented 4 years ago

I'm not sure where the problem is coming from then. I would recommend recording a CPU profile of one timestep (press spacebar) to get a sense for where your code is spending the most time (this page explains how to do it in Visual Studio if you've never done it before).

msnhao commented 4 years ago

Figured it out. Somehow the .exe output directory got reset so when I was building the project, it placed the files in the release directory whereas I was still running the .exe in the build directory which was still the debug version