837 karma · joined Oct 11, 2014 (12y ago) · 272 submissions
comment 9y ago · link · parent
And exercise does help you lose body fat, unless you start eating extra to compensate for the exercise as most people vastly overestimate how much calories you actually burn working out. And of course power-training that helps you build muscle mass can increase your weight but that does not mean that it is bad for you. If you're going to the gym regularlly anyway during your diet just measure your body-composition to track your effective weight. (not sure how accurate that is though).
comment 9y ago · link · parent
Shame they don't let users have a homepage USERNAME.cern like how universities give you a homepage usually at uni.edu/USER/~/index.htlm (or something).
comment 9y ago · link · parent
Simulations are compute heavy, but analysis tasks vary, with the speed of a modern processor future analysis is still likely to be IO/bandwidth limited. The ratio of RAM to core on the test server I have access to is 128/20 so 6.4 GiB per core.
But for (future) analysis the plan is to use, or at least try to use, shared memory and grouping users tasks together based on the required data (They speak of an analysis train with wagons). So a large part of the ram requirements, namely the backing data, should be shared among the cores. I think ideally there will be a top-level scheduler for each node which tries to minimize the required bandwidth (but that is outside the scope of my work so who knows how it's implemented). With a few "best practices" it should be possible for most analysis to consume a 'reasonable' amount of memory at any given time in that case.
comment 9y ago · link · parent
define a
struct S{char flag, data[63];}
then do foreach s in std::vector<S>(big number){
if s.flag == 0{ //set this variable to be very rarely 0
do_something_with(s.data);
}
this will load the entire struct into memory each iteration because loads from memory happen on cacheline granularity (i.e. 64 bytes at a time)then the optimized version is
>And are you using the same number of instructions in both cases?
//define S as struct of arrays now
struct S{char* flags, (*data)[63];}
s = initialize_S(big number);
for(i = 0; i < big number; i++){
if s.flags[i] == 0{ //set this variable to be very rarely 0
do_something_with(s.data, i);
}
This one will load 64 flags into the L1 cache at a time. because the L1 cache is much much faster than main memory access time will be ~64x faster for the checking of the flags. Because it is rare for the loop to enter the if, this means the overal speed will be ~64x faster. As proven by the graph I posted where it is about 16x faster (because I use an int instead of a byte as flag).Syntax is slightly different between SoA and AoS, but functionally they are the same except for how multiple S's are laid out in memory.
>And are you using the same number of instructions in both cases? >Note also: If you are moving data structures of different sizes, you are not using the same number of instructions(calculations), as the challenge required.
The same number of instructions is an arbitrary and impossible task. I'm not going to handwrite assembly for some internet points, I only do that for fun ;). Do they perform the same amount of cpu work though, yes. They are functionally the same and use the same types of instructions. That's about as good as anyone can get it. In any case, the program is completely limited by memory throughput not computation. I could make one of the inner loops a sqrt and the other a nop and the difference would be the exact same.
If you really want to see it in assembly to prove it uses the same amount of instructions, then it's just a mov rax, [rcx], cmp rax, r8, je INNER_FUNCTION, inc rcx {sizeof(S),1} depending on the method. Add 0x90 where appropriate to match instruction counts. The rest is left as an exercise to the reader.
comment 9y ago · link · parent
People can be more or less attracted to one gender than the other. For some this shows up as 100-0 or 50-50 others it's 70-30. To put it crass, someone could be a really slutty straight person but also a very picky gay person.
The whole "born this way" issue I think stems from semantics of "you can be anything you want". I think a lot less people fall into the 100-0 category then they let on but because of societal pressures they don't chose to express or explore a different side (historically this also seems to be reflected). Saying someone can be what they want in that context means that they should feel free to express/explore those curiosities not that they are not innate to them as a person.
And some people just say what they feel is the best thing, not giving it much rational thought, too.
comment 9y ago · link · parent
have an algorithm which takes a large struct S and looks at a subset Sf to determine what to do with S, for some value of Sf use all of S, otherwise skip it. (e.g. when distance between 2 particles < threshold, calculate force).
Now have a very low pass-rate for the filter so that total time ~= time taken to read all of Sf. Make Sf a single byte and S >= 64 bytes (page size if you really want to beat it).
And now compare array-of-struct vs struct-of-array ;). You should see ~64x performance difference in the assymptotic case.
AoS will use one byte per cacheline read. SoA will use 64 bytes per cacheline. if you're memory bound this will translate to an almost 64x speed difference. There are other ways to achieve the same effect but that is the gist of getting 64x performance. using 1 byte vs 64. if you want to go really crazy, use a single bit and a bitfield array for the SoA. If you use a bitfield the passing chance doesn't have to be that low.
I happened to have to present on AoS vs SoA today so I have a less extreme benchmark to show the difference (~16x because it filters over 32 bit ints)
comment 9y ago · link · parent
Often times in those cases you also get great service because a) if you build PCs for a living you're a computer geek and it's fun to build an insane PC and b) they often use their biggest systems as advertisement. At least, that's what I've seen.
+cable management is like black magic to me. If I were to take the money saved as payment for me to get it as nice as those places get it, I'd be below minimum wage.
comment 9y ago · link · parent
From what I've heard and seen it's a total nightmare across the globe in almost every use-case. Just having a way for doctors and nurses to put all information in one clear place while also combining with the infrastructure to enforce certain information (e.g. when medication is retrieved from storage, for who is it, and was it pre-approved) to help prevent things as double-dosing (or forgetting to dose).
Doesn't sound easy tbh, but if you want a challenge here it is.
comment 9y ago · link · parent
comment 9y ago · link · parent
The result of parse().unwrap() is of type F, which means addr is of type 'F'. afterwards when we call `let sock = TcpListener::bind(&addr, &handle).unwrap();` the compiler can infer from the signature of `TcpListener::bind`[2] what F has to be, namely `std::net::SocketAddr`
[1] https://doc.rust-lang.org/std/primitive.str.html [2] https://tokio-rs.github.io/tokio-core/tokio_core/net/struct....
comment 9y ago · link · parent
This makes sense as the clock is also somewhat of the 'driving force' for pushing signals through the chip from one part to the other. (some architectures have 'zero cost' operations I believe, but these are usually baked into the pipeline and have to be turned on-or-off depending on need).
comment 9y ago · link · parent
You can do so, but on modern processors it's ~4 cycles to access the L1 cache and
return 175 & id & ((id ^ 173) + 11)
takes 3 cycles (cylce 1, do the first & and the ^; cycle two, do the +; cycle 3, do the second &).comment 9y ago · link · parent
comment 10y ago · link · parent
Smashing an electron and a positron together produces pure energy to be converted into matter. It could generate photons or it could generate Hadrons just as likely could it not (as long as all quantum numbers are conserved)?
comment 10y ago · link · parent
https://streamcomputing.eu/blog/2016-05-06/noticeable-proces...
comment 10y ago · link · parent
I know this is a big no-no in American culture (and other parts of the world), but it is close to what say India and China are doing by ignoring patents on medicine that is needed but not affordable. To me, this is a much preferable solution to "death panels".
Some would argue that, for economic reasons, this would lead to less research or pharmaceuticals pulling out of the US market. But history has shown the opposite to be true. Again look at China and some of the heavy restrictions it puts on foreign companies there. Do they hurt their bottom-line compared to the 'American approach'? probably. Do they still turn a profit despite them? yes. And that's why many companies still try to get into the Chinese market. profit is profit and as long as they can get some, even if it's pennies, they'll stay in a market.
Let's also not forget that profits in the pharmaceutical industry are insanely high, even when taking into account the cost of research.