CUDA, Immutability vs. Mutability [closed] - multithreading

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I am a firm believer in using immutability where possible so that classical synchronization is not needed for multi-threaded programs. This is one of the core concepts used in functionally languages.
I was wondering what people think of this for CUDA programs, I know developing for GPUs is different from developing for CPUs and being a GPU n00b I'd like more knowledgeable people to give me their opinion on the matter at hand.
Thanks,
Gabriel

In CUDA programming, immutability is also beneficial, and sometimes even necessary.
On block-wise communication, immutability may allow you to skip some __syncthreads().
On grid-wise communication, there is no whole-grid synchronize instruction at all. That is why in general case, to have a guarantee that a change of one block is visible by another block requires kernel termination. This is because blocks may scheduled in such a way that they actually run in sequence (e.g. weak GPU, unable to run more blocks in parallel)
Partial communication is however possible through atomic operations and __threadfence(). You can implement, for example, task queues, permitting blocks to fetch new assigments from there in a safe way. These kind of operations should however be done rarely as atomics may be time consuming (although with global L2 caching it is now better than on the older GPUs)

Related

Multithreading in professional projects [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
To better understand concurrent computing, I would like to know the exact examples of multithreading in projects. Could you list some examples that you came across and describe what responsibilities each thread has?
Please be patient. I'm still learning. :-)
I have seen examples where several threads are used for different purposes: one for handling audit logging, one for handling messaging with external systems, one for the applicative routine (where the actual transaction happens). This is not however a concurrent systems per se, as the threads are handling separate tasks.
One can use threads to divide I/O heavy work: imagine an application processing a lot of files. The basic approach would be to process files one after the other, but the process would be waiting for I/O for every file that is processed. Using a pool of threads and assiging 1 file to each thread can allow the process to keep running: some threads are waiting for I/O, but the others can still keep doing their job. Again, this approach is non-concurrent, as long as you don't process the same file on 2 different threads (one writing to the file and the other one reading, for example).
Multiple Trackers running concurrently is commonly done with threading.

What exactly does it mean for a programming language to be simple? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
What factors are important? How do you know if a given programming language is "simple" or "simpler" than another language?
I'm not sure if this is a fair question to ask, since different languages serve different purposes and it might not really be comparing apples to apples.
However, with that said, memory management would come to mind. One can argue that Java is a "simpler" language than C++, since it has a garbage collector that can deal with some of the complexities around memory management, instead of forcing you to do it yourself.
In my perspective, these are the points that define the complexity of a language.
Variation of syntax from common pseudocode and constructs
Ease of developing a structure for real-life entities like objects
Methods of structure enforcement at compile time.
Memory management strategy allocation/deallocation
Code reusability
Ease of code headers and directives management
Inbuilt libraries
Relative installation package sizes
Data exchange capabilities like over network of files
Process handling like thread management
Relative brevity of the code
Speed of compilation
Developer community size and documentation
OpenSource implementations
Platform dependence
And many more could be added to this list.

What would be the consequences of semi-asynchronous exception handling in GHC? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I'm worried that approach to asynchronous exceptions in GHC might be a net-loss for many applications.
While the paper explains the design to a great detail, it's too complex for average programmers to tell whether this approach provides any benefits at all in their daily work.
Section 2 lists four reasons for current approach (speculative computation, timeouts, user interrupt and resource exhaustion). In my opinion, three are about ability to cancel computations and one is about ability to recover from resource exhaustion which I find questionable (is there any publicly available code that demonstrates this?).
In particular, as mentioned in the paper, Java deprecated Thread.stop() because aborted computation would result in undefined state. Aren't IO actions in GHC subject to the same? Add laziness and the API becomes much more complex in comparison for no clear benefit to most applications.
To summarize, if GHC used the same approach as Java (safe-points, interrupt polling) what would be the consequences to the ecosystem?

Is visual studio optimised for hyper-threaded microprocessors? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I would like to know whether the most common software development suits such as Microsoft visual studio its compilers are optimized for using the Hyper-Threading feature to the maximum extent? Is it worthy to go for a hyper-threaded processor for working with those softwares?
I have read many reviews that hyper threading is only useful for intensive multi threaded applications like video editors,etc..Some reviews says that softwares which are not optimized for using Hyper threading can suffer a decrease in performance and many people run their systems with hyper threading turned off.
As I am a novice programmer I would like to know whether those arguments and reviews stands true in the field of programming.
Again I am talking about the compilers and IDE and not the applications that I 'am going to create!(as if now I don't know how to create multi-threaded applications!!)
Since you have not made up your mind on what IDE/development platform to use then there may be other factors to consider besides threading. Most high level languages and compilers do support thread pooling, which is probably what you are looking for. I can't speak for compilers I have not used so I will leave a link to the article below:
.Net and hyper threading
It appears to be a bit dated, but the basic concepts are explained.

How does Tir compare to other Lua web frameworks? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
How does Zed Shaw's Lua web framwork called Tir, compare to other Lua web frameworks such as Kepler, LuCI, etc?
Comparison to such things like:
maturity of code base
features/functionality
performance
ease of use
UPDATE:
Since Tir is based on the use of Lua's coroutine, doesn't this imply that Tir will never be able to scale well? Reason being, Lua's coroutine's cannot take advantage of multi-core/processor systems given that coroutines are implemented in Lua as a cooperative/collaborative threads (as opposed to pre-emptive)?
Tir is much newer than Kepler or LuCI, so the code isn't nearly as mature. I would rank Tir as experimental, right now. The same factor also means that it has significantly fewer features.
It does have a very pleasant continuation passing style of development available though, through its coroutine based flow stuff.
I would rate it, personally, as fun for experimentation, but probably not ready for heavy lifting until Zed stabilizes it more :-)
This video from PyCon 2011 says basically you scale on multicore or multiprocessor by running more workers, under high load condition the memory advantage gives better performance.
In the video it's said that at Meebo's they have used this approach for last months with huge load.
The video is python specific, so it's just for the scaling of coroutine approach part of the question. Video length is about thirty minutes.

Resources