GPU Programming Expert - Fully Remote
Systems, C++ and performancePosted 4 days agovia Himalayas, a remote job board
- Work type
- RemoteIn India, the US, the UK, Canada, Germany, Australia, Singapore and the UAE
- Experience
- 1+ years
- Pay
- Not listed
- Posted
- 4 days ago
Skills it mentions
Add your skills to see which ones you have.
About the job
About the job
Mercor connects elite creative and technical talent with leading AI research labs. Headquartered in San Francisco, our investors include Benchmark, General Catalyst, Peter Thiel, Adam D'Angelo, Larry Summers, and Jack Dorsey.
Position: CUDA Engineering Expert
Type:Contract
Compensation:$300 per task
Location:Remote
Role Responsibilities
- Analyze and optimize GPU kernels for performance, efficiency, and hardware utilization.
- Use profiler metrics like L2 cache hit rate, L2 throughput, and occupancy to guide kernel improvements.
- Review GPU kernel implementations to identify bottlenecks without needing extensive algorithmic background.
- Write, modify, and reason about C++17, Python, and GPU programming code.
- Apply CUDA, HIP, and shader programming expertise to improve performance outcomes.
- Document optimization decisions clearly, noting when specific profiler metrics are useful.
Qualifications
Must-Have
- Available to work at least 20 hrs/wk.
- Fluent in core C++ features through C++17.
- Working knowledge of Python and Git.
- Fluent in at least one GPU programming model like CUDA, HIP, Slang, HLSL, or GLSL.
- At least 1 year of professional or graduate-level research experience with GPUs.
- Strong understanding of GPU profiler performance metrics for kernel optimization.
- Ability to optimize GPU kernels without deep prior context on every algorithm.
Preferred
- Experience with CUDA, HIP, CUDA C++ Core Libraries, inline PTX assembly, or tensor core-level optimization.
- Experience optimizing kernels for NVIDIA Blackwell hardware.
- Familiarity with NSight Compute.
- Prior experience with GPU hardware organizations like NVIDIA, AMD, or Qualcomm.
- Open-source contributions related to GPU kernel optimization.
Application Process (Takes 20–30 mins to complete)
- Submit your resume or relevant technical background to get started.
- Qualified applicants may be asked to complete a brief technical assessment or submit additional information.
Resources & Support
- For details about the interview process and platform information, please check:
- For any help or support, reach out to:
PS: Our team reviews applications daily. Please complete your AI interview and application steps to be considered for this opportunity.
Originally posted on Himalayas
Interested?GPU Programming Expert - Fully Remote at mercor
Apply on Himalayas (opens in a new tab)The job ad ends here
Interview questions for this job6 with answers, on C++ and Python
Interview questions for this job
For the skills the ad mentions: C++ and Python.
Why are elementwise additions much faster in separate loops than in a combined loop?C++
Upon further analysis of this, I believe this is (at least partially) caused by the data alignment of the four-pointers. This will cause some level of cache bank/way conflicts.
If I've guessed correctly on how you are allocating your arrays, they are likely to be aligned to the page line.
This means that all your accesses in each loop will fall on the same cache way. However, Intel processors have had 8-way L1 cache associativity for a while. But in reality, the performance isn't completely uniform. Accessing 4-ways is still slower than say 2-ways.
EDIT: It does in fact look like you are allocating all the arrays separately. Usually when such large allocations are requested, the allocator will request fresh pages from the OS. Therefore, there is a high chance that large allocations will appear at the same offset from a page-boundary.
Here's the test code:
int main(){ const int n = 100000; #ifdef ALLOCATE_SEPERATE double *a1 = (double*)malloc(n * sizeof(double)); double *b1 = (double*)malloc(n * sizeof(double)); double *c1 = (double*)malloc(n * sizeof(double)); double *d1 = (double*)malloc(n * sizeof(double)); #else double *a1 = (double*)malloc(n * sizeof(double) * 4); double *b1 = a1 + n; double *c1 = b1 + n; double *d1 = c1 + n; #endif // Zero the data to prevent any chance of denormals. memset(a1,0,n * sizeof(double)); memset(b1,0,n * sizeof(double)); memset(c1,0,n * sizeof(double)); memset(d1,0,n * sizeof(double)); // Print the addresses cout << a1 << endl; cout << b1 << endl; cout << c1 << endl; cout << d1 << endl; clock_t start = clock(); int c = 0; while (c++ < 10000){ #if ONE_LOOP for(int j=0;j<n;j++){ a1[j] += b1[j]; c1[j] += d1[j]; } #else for(int j=0;j<n;j++){ a1[j] += b1[j]; } for(int j=0;j<n;j++){ c1[j] += d1[j]; } #endif } clock_t end = clock(); cout << "seconds = " << (double)(end - start) / CLOCKS_PER_SEC << endl; system("pause"); return 0; }Benchmark Results:
EDIT: Results on an actual Core 2 architecture machine:
2 x Intel Xeon X5482 Harpertown @ 3.2 GHz:
#define ALLOCATE_SEPERATE #define ONE_LOOP 00600020 006D0020 007A0020 00870020 seconds = 6.206 #define ALLOCATE_SEPERATE //#define ONE_LOOP 005E0020 006B0020 00780020 00850020 seconds = 2.116 //#define ALLOCATE_SEPERATE #define ONE_LOOP 00570020 00633520 006F6A20 007B9F20 seconds = 1.894 //#define ALLOCATE_SEPERATE //#define ONE_LOOP 008C0020 00983520 00A46A20 00B09F20 seconds = 1.993Observations:
6.206 seconds with one loop and 2.116 seconds with two loops. This reproduces the OP's results exactly.
In the first two tests, the arrays are allocated separately. You'll notice that they all have the same alignment relative to the page.
In the second two tests, the arrays are packed together to break that alignment. Here you'll notice both loops are faster. Furthermore, the second (double) loop is now the slower one as you would normally expect.
As @Stephen Cannon points out in the comments, there is a very likely possibility that this alignment causes false aliasing in the load/store units or the cache. I Googled around for this and found that Intel actually has a hardware counter for partial address aliasing stalls:
5 Regions - Explanations
Region 1:
This one is easy. The dataset is so small that the performance is dominated by overhead like looping and branching.
Region 2:
Read the rest at the sourceFrom Stack Overflow: asked by Johannes Gerer, answered by Mysticial (CC BY-SA 4.0)
How do I convert a string to a number?Python
For integers, use the built-in
int()type constructor, for example,int('144') == 144. Similarly,float()converts to a floating-point number, for example,float('144') == 144.0.By default, these interpret the number as decimal, so that
int('0144') == 144holds true, andint('0x144')raisesValueError.int(string, base)takes the base to convert from as a second optional argument, soint( '0x144', 16) == 324. If the base is specified as 0, the number is interpreted using Python’s rules: a leading ‘0o’ indicates octal, and ‘0x’ indicates a hex number.Do not use the built-in function
eval()if all you need is to convert strings to numbers.eval()will be significantly slower and it presents a security risk: someone could pass you a Python expression that might have unwanted side effects. For example, someone could pass__import__('os').system("rm -rf $HOME")which would erase your home directory.eval()also has the effect of interpreting numbers as Python expressions, so that, for example,eval('09')gives a syntax error because Python does not allow leading ‘0’ in a decimal number (except ‘0’).From Python Frequently Asked Questions (PSF License Version 2)
What does the explicit keyword mean?C++
The compiler is allowed to make one implicit conversion to resolve the parameters to a function. This means that the compiler can use constructors callable with a single parameter to convert from one type to another in order to get the right type for a parameter.
Here's an example with converting constructors that shows how it works:
struct Foo { // Single parameter constructor, can be used as an implicit conversion. // Such a constructor is called "converting constructor". Foo(int x) {} }; struct Faz { // Also a converting constructor. Faz(Foo foo) {} }; // The parameter is of type Foo, not of type int, so it looks like // we have to pass a Foo. void bar(Foo foo) {}; int main() { // However, the converting constructor allows us to pass an int. bar(42); // Also allowed thanks to the converting constructor. Foo foo = 42; // Error! This would require two conversions (int -> Foo -> Faz). Faz faz = 42; }Prefixing the
explicitkeyword to the constructor prevents the compiler from using that constructor for implicit conversions. Adding it to the above class will create a compiler error at the function callbar(42). It is now necessary to call for conversion explicitly withbar(Foo(42))The reason you might want to do this is to avoid accidental construction that can hide bugs.
Contrived example:- You have a
MyStringclass with a constructor that constructs a string of the given size. You have a functionprint(const MyString&)(as well as an overloadprint (char *string)), and you callprint(3)(when you actually intended to callprint("3")). You expect it to print "3", but it prints an empty string of length 3 instead.
From Stack Overflow: asked by Skizz, answered by Skizz (CC BY-SA 4.0)
- You have a
What are metaclasses in Python?Python
Classes are objects
Before delving into metaclasses, a solid grasp of Python classes is beneficial. Python holds a particularly distinctive concept of classes, a notion it adopts from the Smalltalk language.
In most languages, classes are descriptions of how to create an object. That is somewhat true in Python too:
>>> class ObjectCreator(object): ... pass >>> my_object = ObjectCreator() >>> print(my_object) <__main__.ObjectCreator object at 0x8974f2c>But classes are more than that in Python. Classes are objects too.
Yes, objects.
When a Python script runs, every line of code is executed from top to bottom. When the Python interpreter encounters the
classkeyword, Python creates an object out of the "description" of the class that follows. Thus, the following instruction>>> class ObjectCreator(object): ... pass...creates an object with the name
ObjectCreator!This object (the class) is itself capable of creating objects (called instances).
But still, it's an object. Therefore, like all objects:
you can assign it to a variable1
JustAnotherVariable = ObjectCreatoryou can attach attributes to it
ObjectCreator.class_attribute = 'foo'you can pass it as a function parameter
print(ObjectCreator)
1 Note that merely assigning it to another variable doesn't change the class's
__name__, i.e.,>>> print(JustAnotherVariable) <class '__main__.ObjectCreator'> >>> print(JustAnotherVariable()) <__main__.ObjectCreator object at 0x8997b4c>Creating classes dynamically
Since classes are objects, you can create them on the fly, like any object.
First, you can create a class in a function using
class:>>> def choose_class(name): ... if name == 'foo': ... class Foo(object): ... pass ... return Foo # return the class, not an instance ... else: ... class Bar(object): ... pass ... return Bar >>> MyClass = choose_class('foo') >>> print(MyClass) # the function returns a class, not an instance <class '__main__.Foo'> >>> print(MyClass()) # you can create an object from this class <__main__.Foo object at 0x89c6d4c>But it's not so dynamic, since you still have to write the whole class yourself.
Since classes are objects, they must be generated by something.
When you use the
classkeyword, Python creates this object automatically. But as with most things in Python, it gives you a way to do it manually.Remember the function
type? The good old function that lets you know what type an object is:>>> print(type(1)) <class 'int'> >>> print(type("1")) <class 'str'> >>> print(type(ObjectCreator)) <class 'type'> >>> print(type(ObjectCreator())) <class '__main__.ObjectCreator'>Well,
typealso has a completely different ability: it can create classes on the fly.typecan take the description of a class as parameters, and return a class.(I know, it's silly that the same function can have two completely different uses according to the parameters you pass to it. It's an issue due to backward compatibility in Python)
typeworks this way:type(name, bases, attrs)Where:
name: name of the classbases: tuple of the parent class (for inheritance, can be empty)attrs: dictionary containing attributes names and values
e.g.:
>>> class MyShinyClass(object): ... passcan be created manually this way:
Read the rest at the sourceFrom Stack Overflow: asked by Bite code, answered by Bite code (CC BY-SA 4.0)
Why is reading lines from stdin much slower in C++ than Python?C++
tl;dr: Because of different default settings in C++ requiring more system calls.
By default,
cinis synchronized with stdio, which causes it to avoid any input buffering. If you add this to the top of your main, you should see much better performance:std::ios_base::sync_with_stdio(false);Normally, when an input stream is buffered, instead of reading one character at a time, the stream will be read in larger chunks. This reduces the number of system calls, which are typically relatively expensive. However, since the
FILE*basedstdioandiostreamsoften have separate implementations and therefore separate buffers, this could lead to a problem if both were used together. For example:int myvalue1; cin >> myvalue1; int myvalue2; scanf("%d",&myvalue2);If more input was read by
cinthan it actually needed, then the second integer value wouldn't be available for thescanffunction, which has its own independent buffer. This would lead to unexpected results.To avoid this, by default, streams are synchronized with
stdio. One common way to achieve this is to havecinread each character one at a time as needed usingstdiofunctions. Unfortunately, this introduces a lot of overhead. For small amounts of input, this isn't a big problem, but when you are reading millions of lines, the performance penalty is significant.Fortunately, the library designers decided that you should also be able to disable this feature to get improved performance if you knew what you were doing, so they provided the
sync_with_stdiomethod. From this link (emphasis added):If the synchronization is turned off, the C++ standard streams are allowed to buffer their I/O independently, which may be considerably faster in some cases.
From Stack Overflow: asked by JJC, answered by Vaughn Cato (CC BY-SA 4.0)
Have you ever failed at a task?Behavioural
Employers usually base questions on jobs you have done in the past. This gives you the chance to talk about your experience. For instance, they might ask:
- when have you faced a challenging situation?
- can you tell us about a personal achievement at work?
- have you ever taken the initiative?
- have you ever failed at a task?
Your answers should reflect the skills the employer wants. Be positive and tailor your examples to the job description.
If you don't have much work history, you can use examples from outside of work. You can also use examples from volunteering experience.
Use the STAR method to help structure your answers.From National Careers Service: interview advice (Open Government Licence v3.0)
Similar jobs
- Senior HPC engineerWeekday, Delhi NCR, on-siteYesterday
- Sr. C++ EngineerHarmonic Inc, Bengaluru, hybrid2 days ago
- Developer : C++/ADASBosch Group, Bengaluru, on-site3 days ago
- Software Engineer - C++, Networking(Layer2/Layer 3) | 4-8 YearsCisco, Bengaluru, on-site3 days ago
More like this: C++ and systems jobs in India (161) and Remote C++ and systems jobs in India (39)



