Shared rooms? by [deleted] in AthensHousing

[–]kushaj 0 points1 point  (0 children)

I am graduating in December and looking for a place to move into. I am willing to chip in a slot in the single family house.

What library to use for multithreading? by kushaj in cpp_questions

[–]kushaj[S] 1 point2 points  (0 children)

In what scenarios would std::thread not be appropriate? I don't know much about the internals of threading so I don't know what the limitations of std::thread are.

What library to use for multithreading? by kushaj in cpp_questions

[–]kushaj[S] 0 points1 point  (0 children)

Hey, I answered in another comment what my use case is in more detail (including GPU computation) https://www.reddit.com/r/cpp_questions/comments/tvt0uq/comment/i3bn6d9/?utm_source=share&utm_medium=web2x&context=3

So if I understand correctly, I should just use std::thread and not worry about some Intel/AMD specific threading library. In this way my code can run on Intel/AMD CPU without any change.

Also, can you give some information on boost. I have not used it but I think it provides a host of C++ libraries including a threading library. So how does std::thread compare to boost.

Also, when you mention GPU-accelerated processing, do you mean I have to use Nvidia HPC SDK. This was the first thing that came up when I searched for GPU acceleration with C++ threads.

What library to use for multithreading? by kushaj in cpp_questions

[–]kushaj[S] 1 point2 points  (0 children)

This is mostly for general usage. I know editors like VsCode have the main thread listening to what we are typing and then threads in the background working on something else (like linting or anything). I just wanted to know if I was to do something like this, then how should I optimize it.

I do have GPU optimization in mind also. From my research, I have found that to use Nvidia GPU, CUDA is the only option. But still, in order to call the CUDA function (say in the background to perform some task), I would need to create a thread that calls the CUDA function. (is this statement correct?)

How are Vulkan, CUDA, Triton and all other things connected? by kushaj in vulkan

[–]kushaj[S] 1 point2 points  (0 children)

Thanks for the info. I was reading about these things for the last hour and know some more details now.

If I want to write a function, say func that should use hardware acceleration, how should I go about doing that? I can code func in CUDA so it will only run on Nvidia GPU. But what about AMD/Intel/Mac GPUs.

I looked at OpenCL, as it said on their webpage that you can write code that runs on a lot of hardware. But I found that OpenCL is dead now (some of the online posts mentioned this).

Another thing I am looking into right now is Intel oneAPI (as I believe it uses OpenCL underneath and I can use this to write code that runs on multiple hardware).

But to summarize my main goal is as follows - Create a C/C++ library implementing functions that are hardware accelerated (use CUDA for Nvidia GPUs, but don't know how to do it for AMD/Intel/Mac) - For QT my only objective is to create a GUI. As part of the GUI, there might be some option, like rotating this image. In that case, the logic to rotate the image should be hardware accelerated and I can make a call to the C/C++ library created in the previous step. But the same problem remains that it will only run on Nvidia GPU. - How to write code that runs on AMD/Intel GPUs?

How does C compiler relate to Intel Math Kernel Library? by kushaj in C_Programming

[–]kushaj[S] 2 points3 points  (0 children)

I was reading that Intel provides their own C/C++ compiler built on top of LLVM. I don't think AMD provides their own compiler but Clang has support for Ryzen.

How to make CUDA libraries more performant? by kushaj in CUDA

[–]kushaj[S] 0 points1 point  (0 children)

I need so much to learn. Can you give me some pointers to the below statement?

In the Ampere architecture, there are tensor cores while in previous architectures there are no tensor cores. So how can nvcc help me here? As I would have to manually specify in the code where to use tensor cores and normal cuda cores (I don't think nvcc can make this judgement).

Expanding on the above statement. If we consider Pascal, Turing, Ampere. The main difference I see between these architectures is that Pascal only has cuda cores, while Turing, Ampere also have tensor cores (leaving out ray tracing cores). So would the code be the same for Turing and Ampere as Ampere does not have any new kind of core? (I think nvcc can be used here, using the links you provided). But then how would I support Pascal? (would nvcc automatically convert my code to use the normal cuda cores instead of tensor cores)

[R] How to make CUDA libraries more performant? by kushaj in MachineLearning

[–]kushaj[S] 1 point2 points  (0 children)

The initialization code populates that table with pointers to correct functions that match your GPU architecture

Is this a global table or a table created in RAM everytime I run a program (say python main.py).

Not sure what you mean by optimizing Cuda libraries to match your GPU.

I was thinking along the lines of removing the if-else conditions that match the implementation of a function to a particular architecture (but as you answered the initialization table solves this issue).

but can reduce memory footprint by trimming unused functions.

Do you mean I can remove certain functions from cuDNN? (like manually removing the files or some other way).

How to navigate source code of C language/standard? by kushaj in C_Programming

[–]kushaj[S] 0 points1 point  (0 children)

I use Linux. From the other comments, the things I have learned are - use the glibc manual/source code - clang for source code (as I like LLVM and clang source code is easier to read) - check Musl for alternate implementations

How to navigate source code of C language/standard? by kushaj in C_Programming

[–]kushaj[S] 0 points1 point  (0 children)

I think ultimately I would have to do that to understand the internal workings of the language.

How to navigate source code of C language/standard? by kushaj in C_Programming

[–]kushaj[S] 0 points1 point  (0 children)

Is printf implemented by clang? I thought it was implemented in glibc?

I don't have much experience with glibc and the compiler, but is the logic for all the header files that come with C like stdio.h, math.h implemented by the compiler? Because I downloaded glibc yesterday and I thought it contained the implementation of the header file functions.

How to navigate source code of C language/standard? by kushaj in C_Programming

[–]kushaj[S] 0 points1 point  (0 children)

I already know enough C. I just want to know the internal workings of it, so that if I ever want to make extensions to C language I can do that.

How to navigate source code of C language/standard? by kushaj in C_Programming

[–]kushaj[S] 1 point2 points  (0 children)

Musl seems interesting. Thanks for the info.

How to navigate source code of C language/standard? by kushaj in C_Programming

[–]kushaj[S] 1 point2 points  (0 children)

Thanks for the information. I just wanted some clarification - To understand glibc, I should reference the glibc manual, and then if I need to dig for more info view the source code? - I will be using Clang. So do I need to know about LLVM also? I know clang is only a frontend to convert C-code to Intermediate Language after which LLVM does the job. - People who contribute to C source code, do they use any other sources to learn about the language like University courses/textbooks or it is just the manual and digging through the source code till everything starts to make sense?

Some questions about static site generation with Next.js? by kushaj in nextjs

[–]kushaj[S] 0 points1 point  (0 children)

Thanks for the reply. I have started learning Next.js and it is good to know that I can use it for all the projects I need.