New answers tagged

0

One real world example is the open source LuxRender rendering engine, which is capable of fully loading a CPU and GPU at the same time. In addition, it can load multiple GPUs at the same time and can also distribute across multiple computers. LuxRender uses OpenCL to facilitate this, although builds without OpenCL also exist. This is practical because ...


2

The database can only hold 1 write concurrently and does not support transactions. If this value is exceeded, the database responds immediately with an error code XXXXX. This is extremely bizarre for any modern database, but let's accept the premise. At a high-level, there are 2 approaches to concurrent data modifications: Pessimistic - This is lock-...


2

Reading the specs, the main point of your requirement is: An user should receive an immediate response that vote was accepted. To achieve that, you could separate out the vote-taking-part. Each of your two instances need to talk to a component responsible for that. Then the problem arises, this component becoming the bottleneck in your architecture. ...


0

The database can only hold 1 write concurrently and does not support transactions Lack of transaction is the main issue. I would suggest: If possible, update to a different RDBMS capable of transaction, e.g. Postgres. You really need ACID properties (or at least an RDBMS capable of locks), so that is the only honest and professional solution. otherwise, "...


1

You might be interested in checking out the Servo browser engine being developed at Mozilla Research, and more specifically its Web Render (video). While shifting a task from CPU to GPU dynamically might be impractical, as mentioned in other answers (notably @Philip's), it can be practical to study the load of CPU/GPU on typical workloads in advance and ...


9

From a supercomputing viewpoint it is better not to think in CPU/GPU load in percentage but rather determine how many operations your problem at hand needs and then compare that to the peak performance of the system. If you get 100% CPU utilization it does not necessarily mean that you get all the performance out of the system. CPUs can often do multiple ...


0

With a focus on games (since you mentioned it specifically in your post), there are some ways you can balance the load. One example is "skinning", i.e. animating a model. For each frame to be rendered, you have to generate the transformation matrices for each frame of animation and apply it to the vertices of the model to transform it into the pose it needs ...


47

Theoretically yes, but practically it's rarely worth it. Both CPUs and GPUs are turing-complete, so any algorithm which can be calculated by one can also be calculated by the other. The question is how fast and how convenient. While the GPU excels at doing the same simple calculations on many data-points of a large dataset, the CPU is better at more ...


29

It is not related to game programming. Some scientific code can also use both the GPU and the CPU. With careful -and painful- programming, e.g. by using OpenCL or CUDA, you could load both your GPU and your CPU near 100%. Very probably you'll need to write different pieces of code for the GPU (so called "kernel" code) and for the CPU, and some boring glue ...


0

This question states an incorrect premise as fact, then makes an argument about that incorrect premise. Lets dig in to this .. "all their design points to minimizing GC use" - simply isn't true. The innovation in the disruptor has little to do with GC. The disruptor performs because its design cleverly considers how modern computers work - something that's ...


1

A few tips. Local variables are declare local and initializated to null if strings or 0 if number if you develop in bash use bash. (+=, for arg;do done;...) Use always builtin [[ notnumber ]] or (( number )) never [,test,( or any other function() { local runCommand= local -i index=0 #you don't need the extra parameters here for strings; do ...


3

For a single simple method, using a stopwatch can work well. For larger, more intricate code, though, what you want is a profiler, an external tool that attaches to your program as a debugger, lets you run it, and monitors how long the code that you're executing takes and where the time is being spent. When you're finished, it gives you a statistical ...


2

You could read the available folder names just once, and store their names in a local file. When the macro is run again, read that file into memory and use it to find the full folder name for a given project number quickly. Once you know the full name and folder path, navigating to the folder object should be easy (see here for a generic solution, utilizing ...


0

Only Apple knows the actual answer to this question. But one possible answer is that source code and compiler optimizations for particular CPU implementations and memory hierarchies can actually make a significant difference in user visible performance (and battery usage, etc.) If the newer OS code was profiled and optimized on newer devices with CPUs ...


1

Embedded development. When you're working with a tiny memory footprint and real time requirements you have to constantly be thinking about every aspect of performance, both speed and memory. Real time embedded devices often require response times in the order of milliseconds in my experience. If a routine is off running for 10 seconds somewhere, you've ...


3

If they have competitors, then performance is a major criterion by which they are judged. By the way, if you think performance is a matter of using switch vs. if, you're missing the point by an enormous margin. You don't know what to fix in the code until you find out what takes time. That can seldom (i.e. never) be done by eyeballing the code. What I do ...


1

Projects that have performance requirements. It really doesn't matter what the hardware is. I can drive anything to 100% utilization. Same as I can fill any hard drive. The question is, can I ignore performance and still hit my performance goals. If yes, I am justified in ignoring performance. Some projects find they have performance problems. If they ...


0

Here is one of the efficient algorithm for counting number of divisors and also summing them up for giving the correct output. import java.math.BigInteger; import java.util.Scanner; class ProductDivisors { public static BigInteger modulo=new BigInteger("1000000007"); public static BigInteger solve=new BigInteger("1"); public static BigInteger two=new ...


-2

I had a problem with this recently, inside a foreach loop I was declaring a complex variable, and using it in a "ByRef" or "ref" function inside the loop. It turned out the variable was picking up the "last iteration's data" regardless of which iteration it was in! I don't know if this makes a difference... But I ended up having the declare the variable ...


4

Wow. Function calls are slower than string searches? What implementation of Java are you using? I used to write assembly, and the manual would tell how many "clicks" each instruction took on the processor. Those days are gone, but if I had to guess how many clicks various operations take, I'd guess something like the following: bitwise operations: 1 ...



Top 50 recent answers are included