24

I know that you only answer questions that are worthy of an answer. One of the things that makes a question worthy of being answered is whether the writer put effort in it.

I found myself in need of help. I did my research, read all the correlated documentation, searched around the site, but there were no duplicates of my question. Before posting I informed myself on how to post good questions. I think I applied all the rules, but the truth is that I didn't, because the post got downvoted

I don't want to make you all angry: I just want to learn what I did wrong so both me and the community will be happy. I will be happy because I will be able to both get helped and help others, while the community will be happy because there is 1 less guy that posts bad questions and 1 more guy that helps others and contributes.

Here is my question:

Vectorizing for cuda a function that takes a complex number as input and a complex number as output fails in numba

16
  • 38
    Thank you for approaching this in a civil manner. It's worth noting right off the bat that many users on Stack Exchange routinely do not comment on their downvotes, as their efforts are often met with hostility and defensive statements instead of actual constructive attempts to improve the question. This aspect of the network can often be a culture shock for new users, and I'm guessing that's the case here.
    – F1Krazy
    Commented Feb 24, 2021 at 16:05
  • 9
    Well, what I see is code which you admit is not yours (honest, but that does not make it better), multiple questions in one... it reads like you pulled something off of the web and are basically just trying things instead of working off of a basis of research and understanding. That is a very shaky foundation for a question to be worthy of Stack Overflows quality standards for questions.
    – Gimby
    Commented Feb 24, 2021 at 16:08
  • 14
    A side note: How something reads does not have to be proof of what your intentions are - for all I know you have the best of intentions and spent hours researching. But what people can read is all people have, they can't look in your brain or at your computer history. So your question needs to show it.
    – Gimby
    Commented Feb 24, 2021 at 16:09
  • 3
    Thank you. So, from what I understood, I should focus more on asking one question at the time even if it's directly correlated. Am I right? I understand what all the code does and that is the reason why I can't understand that error. Also, I should put all the things that I know about the problem in the question (for example I should explain what I think the error is) so people understand that I know what I'm talking about and I understand the code. Am I right?
    – TechTheGuy
    Commented Feb 24, 2021 at 16:11
  • 1
    Apart from the minimal issue that I commented on that question, the issue is that you didn't (and probably can't) include enough info for other people -- although it might or might not be a problem (Should we close-vote questions that we cannot reproduce on our machines? - Meta Stack Overflow) -- nevertheless ... asking "what are the possible causes" ... is that allowed?
    – user202729
    Commented Feb 24, 2021 at 16:22
  • I added the minimal reproducible example, so people should now be able to reproduce the issue.
    – TechTheGuy
    Commented Feb 24, 2021 at 16:30
  • 16
    Consider to remove the original code, and only show the MRE instead. Right now the original code only serves to waste peoples' time when they try to understand it before seeing the MRE at the bottom. Commented Feb 24, 2021 at 17:37
  • 13
    Note that people, if they are interested, can see the full edit history of your question (beyond the first five minutes of the post's existence) if they so desire, so there's no need to keep a history of the question; no "EDIT" or "UPDATE" headers; no announcements needed. If there are no answers, just edit the question so that it appears as if the question was always the best it could be. Commented Feb 24, 2021 at 18:21
  • ok thank you. I am going to remove the non MRE code
    – TechTheGuy
    Commented Feb 24, 2021 at 18:55
  • 4
    Does this answer your question? When is it justifiable to downvote a question?
    – gnat
    Commented Feb 24, 2021 at 21:16
  • 6
    Doesn't look like a good dupe to me, @gnat. OP is asking about the specific question and what can be improved in it.
    – 10 Rep
    Commented Feb 24, 2021 at 22:39
  • 2
    "I just want to learn what I did wrong..." It's just my opinion but I think that initially you did not enough to pinpoint the issue. Some code, an error message and not much else, looks very much like "do my work for you". A minimal example for these cases and a clear description of what you want to achieve goes a long way to make a great question. Also please not only do research but also show it. Commented Feb 25, 2021 at 15:02
  • 1
    @10Rep To be fair the question was titled differently when gnat proposed that dupe. however, I could still see it being an acceptable dupe target because OP's sort of still asking why his question was poorly received and the dupe target goes into the reasons users might receive questions poorly.
    – TylerH
    Commented Feb 25, 2021 at 19:47
  • 1
    Just to say that I have just deleted my post as some (very few) users who didn't like my answer went as far as to go to my Stack Overflow profile to downvote some of my questions. I think this kind of behavior should be sanctioned as it is not the spirit of Stack Overflow (I hope). As for my opinion, I understand that many do not like the idea of "homework" tag and I accept the downvotes as disagreement, and as for unfortunate usage of "Boomer" (which I discovered was extremely negative) and negative depiction, I clarified myself and was not intending to hurt anyone's ego. Commented Feb 26, 2021 at 16:17
  • 2
    @AntoninGAVREL I don't think you hurt anyone. Revenge downvoting sucks, and I encourage you to undelete your post and flag the downvoting for mod/CM attention. Depends on how many downvotes though.
    – 10 Rep
    Commented Feb 26, 2021 at 17:07

3 Answers 3

10

Typically, people here appreciate when you add a MRE. Basically code that helps users understand how much you understand.

Research effort is not required by the rules. If someone closes your question because of just that then it should be reopened. Code is also not a requirement, as some questions don't really need code.

You added an MRE, and your question has now been reopened and has a net score of 5 (with 8 upvotes). So it's safe to say that your question is now pretty good.

As for the downvotes.... one downvote doesn't mean much. I would understand why they downvoted before you added the MRE, but even now anyone can downvote. I'm not saying this is applicable in this case, but sometimes new users treat the downvoters in a wrong way, which is why lots of people don't comment when downvoting.

It's kind of frustrating to receive a downvote without explanation but that's just the way it is sometimes.

6
  • "Research effort is not required by the rules." Not sure I understand that part right. A lack of presented research is not a close reason but a potential downvote reason. Commented Feb 25, 2021 at 14:58
  • 5
    While research effort and code are not required by the rules, the absence of one or both is generally a good indication of a poor question. Remember: the onus is on you, the asker, to make your question as easily answerable as possible; not on us, the potential answerers, to attempt to divine meaning from your question. Help us to help you.
    – Ian Kemp
    Commented Feb 25, 2021 at 15:16
  • "It's kind of frustrating to receive a downvote without explanation but that's just the way it is sometimes." The implicit meaning of a downvote is "your question needs improvement" and once again, the onus is on the question asker to figure out why this is; not on the person downvoting to explain themselves.
    – Ian Kemp
    Commented Feb 25, 2021 at 15:21
  • 1
    "Asking a question on [Stack Overflow] isn't a right, but a privilege", a privilege that can and will be lost for the lack of showing research effort.
    – Braiam
    Commented Feb 25, 2021 at 17:09
  • 7
    @Braiam no, that isn't true at all. When someone answers a question, they don't care about how much time or effort they put into a question. They just care if it is answerable and useful to future readers. Sometimes research effort is required, but in a lot of cases it's used in the wrong way to close a question, which is wrong. It might be a downvote reason, but that's abotu it.
    – 10 Rep
    Commented Feb 25, 2021 at 17:10
  • 1
    I don't know what you think I'm arguing for. Lack of research effort is a downvote reason, with enough downvotes you will be denied of asking questions on Stack Overflow. Aren't you too sensitive?
    – Braiam
    Commented Feb 25, 2021 at 17:13
11

I can't speak for the downvoters. Downvotes are anonymous and subjective by-design. Personally, I wouldn't have downvoted your question.

That said, there are a few things that can be improved. Firstly, as philipxy and MisterMiyagi suggested, it would be better if you moved the larger (not minimal) code under the MRE or removed it entirely. Currently, it servers little to no purpose.

Secondly,

What is the problem?

The code is not mine: I found it at <link>

I just modified some pieces.

doesn't sound like you have a good understanding of your code. This can make answering your question hard as the answerer doesn't know about your knowledge and understanding of the subject. How do you demonstrate your knowledge in the subject? By showing us what you have researched and what you understood (and didn't understand) from that research. Pretty much what Gimby said.

Thirdly,

i tried really hard to find some info online but i couldnt find any. This is my first time running python on gpu and im really excited.

Also, sorry. The formattation is probably horrendous but i tried as hard as i could.

Thank you in advance.

isn't required in the question. If you "tried really hard" then please show us something, if you didn't find anything then please demonstrate an understanding of the code by creating a MRE (which you later did of course). Don't worry if the formatting isn't fine, you can ask someone in the comments to help you out with it. But avoid adding meta commentary to the post itself, that is better suited in a comment. Avoid adding "thanks" to a post.

8

A lot of non subject matter experts are replying, and while I typically don't use numba for my python projects using cuda, I know a lot about GPUs, CUDA, and python, there are a few things that stand out to me and definitely show that your question is worth downvoting.

I took a program that makes a mandelbrot plot and made it run on a CPU thread using njit.

Okay, so you want to display the mandelbrot set? Cool makes sense. And you used numbas' njit utility to perform jit compilation. Cool

Now I want to generate a 32k image

Here is where I'm like, okay, now this is starting to get annoying. What do you mean by 32k image? You could mean 32k phyiscal pixels, 32k x 32k, or any number of other things. Your code you show does not help either. My first guess was a 32k x 32k image, but your code actually doesn't signal that at all, WIDTH = 15360 HEIGHT = 8640 implies that actually you made a mistake and you meant 16k, and you meant it in terms of display vendor marketing 2k,4k,8k nomenclature. That's a lot of garbage you've made me parse, and it isn't because of a MVCE or what ever, it's because of negligence. and I'm probably still wrong about my conclusion, I've had to try to mind read afterall. What's more, it likely has nothing to do with your issue, and that's something you should have been able to figure out before hand. Your error clearly says nothing about a "memory" overflow or what ever. Your mandebrot set could have been 2 times as large or a 100th of the size and it wouldn't matter to your question.

but even a whole thread is too slow.

What do you mean by a whole thread? A single thread? One thread? Okay, so why did you jump straight into CUDA then? The first use case I find on google for njit, something I've literally never used before was automatic CPU parrallelization. Fine that's irrelevant to your specific problem, but this kind of error, which apparently was strange enough that multiple revisions of your post by other people left it unchanged, added more mental overload, and we haven't even gone through two sentences of your post yet.

So I tried to make the code run on a GPU. Here is the code:

At first this code looks fine, especially to someone who is not familiar with python or the concept of "vectorization". But you clearly don't understand what vectorize does, and much of the basic information in numba. Again, I'm not an expert in numba, I've never used numba extensively, I didn't even know what vectorize did before today. Vectorize doesn't make sense when you aren't, you know, vectorizing. Vectorizing needs a vector of inputs. You straight up don't do this. You clearly didn't follow any tutorials or documentation before attempting this.

You also provide an error that clearly has nothing to do with your proposed "solution" and comes from some sort of configuration error completely irrelevant to the specific problem you're working on.

You also talk about performance problems, your question is full of smaller questions an quirks too broad for SO, even if you don't ask about them directly.

Then you answer your own question, and even that answer is completely wrong in terms of performance and will probably confuse new users rather than help them. The only thing you got right was realizing the ignored the basic instructions for installing numba https://numba.pydata.org/numba-doc/latest/user/installing.html ie you didn't even install the cudatoolkit...

3
  • 1
    This is somewhat like a rant, like saying the code is "garbage", saying it is "annoying", etc.
    – 10 Rep
    Commented Feb 26, 2021 at 5:55
  • 1
    @10Rep I wasn't talking about the code, parsing was in reference to parsing possible meanings of OPs statements, I didn't know what other word to refer to "useless things I have to do because of the garden pathing and poorly conveyed communication that was still left behind after multiple edits". There's probably a better word. I'm not sure what I would replace annoying with either, I'm not sure it isn't the correct word choice either.
    – Krupip
    Commented Feb 26, 2021 at 6:13
  • 1
    It might be a bit harsh but it's true. Someone without prior knowledge of GPU could just try something on CPU and then be "i'll try it in GPU from some tutorial like I alwas did". But the fact is that GPU programming require more understanding than just reading some exemple. To be honest even something like Java2D would still require some decent knowledge about how it works for this kind of works if you want good performance. And lots of tutorial don't handle that, they'll show you how to do one nice drawing or a snake, with or without good usage of the GUI components/GPU, and that's all.
    – Walfrat
    Commented Feb 26, 2021 at 15:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .