Do all the things like ++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatarSign Up
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple APILearn More
Search - "opencl"
Most of the code I write nowadays is for GPUs using a dialect of C. Anyways, due to the hardware of GPUs there is no convenient debugger and you can't just print to console neither.
Most bugs are solved staring at the code and using pen and paper.
I guess one could call that a quirk.12
"OpenGL, OpenCL deprecated in favor of Metal 2 in macOS 10.14 Mojave". Another reason I'm never buying another Apple computer.4
Follow-up to my previous story: https://devrant.com/rants/1969484/...
If this seems to long to read, skip to the parts that interest you.
~ Background ~
Maybe you know TeamSpeak, it's basically a program to talk with other people on servers. In TeamSpeak you can generate identities, every identity has a security level. On your server you can set a minimum security level you need to connect. Upgrading the security level takes longer as the level goes up.
~ Technical background ~
The security level is computed by doing this:
SHA1(public_key + offset)
Where public_key is your public key in Base64 and offset is an 8 Byte unsigned long. Offset is incremented and the whole thing is hashed again. The security level comes from the amount of Zero-Bits at the beginning of the resulting hash.
My plan was to use my GPU to do this, because I heared GPUs are good at hashing. And now, I got it to work.
~ How I did it ~
I am using a start offset of 0, create 255 Threads on my GPU (apparently more are not possible) and let them compute those hashes. Then I increment the offset in every thread by 255. The GPU also does the job of counting the Zero-Bits, when there are more than 30 Zero-Bits I print the amount plus the offset to the console.
~ The speed ~
Well, speed was the reason I started this. It's faster than my CPU for sure. It takes about 2 minutes and 40 seconds to compute 2.55 Billion hashes which comes down to ~16 Million hashes per second.
Is this speed an expected result, is it slow or fast? I don't know, but for my needs, it is fucking fast!
~ What I learned from this ~
I come from a Java background and just recently started C/C++/C#. Which means this was a pretty hard challenge, since OpenCL uses C99 (I think?). CUDA sadly didn't work on my machine because I have an unsupported GPU (NVIDIA GeForce GTX 1050 Ti). I learned not to execute an endless loop on my GPU, and so much more about C in general. Though it was small, it was an amazing project.1
You know your codebase is fucked beyond restoration when a one-dimensional array is indexed using two indices and this formula.
guess what - it’s my anniversary of first joining devRant. I joined exactly 0x16d days ago, and it’s been great.
ive learnt so much, made more stuff, and y’all are great.
id like to follow up on my resolutions from last year ( https://devrant.com/rants/364344/... ), and im proud to say i did everything except the 3d game (i was looking opengl and got distracted by opencl).
when i first saw devRant, i was on a plane, coming home. i saw a news article and decided to check it out, and when i joined i quickly realized i was the second youngest on the platform. one year, 316 rants, 2181 comments, and a score of 18594++ later, here i am.
thanks for this wonderful platform!20
I'm reinventing the wheel by making yet another neural network library. It's not any good yet but I learn as I go along.
The only documentation that exists now is the admittedly quite comprehensive code comments. I'm it because Keras (using TensorFlow) requires a 3.5 compute ability rating for CUDA acceleration (which I don't have) and it doesn't support OpenCL. Eventually, I will make my implementation support both with varying levels of acceleration for different compute capabilities with the oldest supported being my hardware. If I ever get around to it.
I'd say wish me luck but determination would be infinitely more useful.2
Okay so I'm completely new to OpenCL and I just put some stuff together to get a simple GPU Kernel running. Well that worked pretty good.
The reason I got into OpenCL was because I wanted to do some simple SHA1 cracking on my GPU. What I did was, I got a fast implementation of SHA1 from the internet, which works perfect in normal C++, but for OpenCL I have to rewrite some things. So I replaced all the memset and memcpy and so on with simple for loops and it still worked. Now, this should work on OpenCL, too, I thaught. God I was wrong!
Somehow the clBuildKernel got executed normally, but when I try to access the returned value (the error code) I get an Access Violation? It just doesn't make any sense to me?
Well I will try some stuff tomorrow again and I will find a solution for sure, but still, until now I just don't understand it.
Everyday we learn something new.
I learnt today that mesa OpenCL support is shit.
And i spent half an our compiling the AMD open source rocm to have proper support.
Wait. Now that i can use openCL on my laptop i could mine some coins on 2 GPUs.
What's your most trusted computer part manufacturer list? Personally, it goes something like this:
CPU: AMD. They're performing at or above Intel's spec, without the weekly IME holes. Sometimes cost a little more, but they last way longer.
GPU: AMD, ASUS, MSI. MSI is usually over-priced but performs a smidge better, ASUS is usually a good middle-ground. Anything with an AMD chipset's usually gonna hold together fairly well, though, and won't require massively-unstable closed-source drivers for decent Linux performance. "but muh cuda" doesn't fly when OpenCL is actually, well, open.
Storage: Seagate, obviously, and SanDisk for cheap SSDs. SanDisk SSDs, especially their cheapest ones, are durable as shit for price. As for the Seagate pick... is that not self-explanatory?
Mobo: ASUS, ASRock if you need garbage in a pinch. ASUS boards are usually fairly tough, and ASRock is cheap trash for that backup tower that's gone bad in the closet.
PSU: EVGA, accept no substitute. EVGA PSUs are durable as fuck and fairly cheap, compared to other "ultra-durable" brands.39
Let me start this off by stating I'm a Java dev, and a noob with C++.
Thought it'd be cool to learn some OpenCL, since I want to do some maths stuff and why not learn something new.
So I sat down, installed Nvidia proprietary drivers, broke my x-org server, purged, reinstalled, rebooted and after a while I got stuff sorted out.
Then on to my IDE. I use CLion and it uses Cmake. C++ noob knows shit about Cmake, so struggle for two hours trying to figure out wtf is going on with the OpenCL libs and why they're only partially detected. Fml.
Finally, everything is configured and I'm set. I start working on a Hello World program using OpenCL. Finish it in 20 mins, all good. No output. Do some googling, check my program a million times. Nothing wrong here. Check the kernel, everything as in the tutorial.
I start checking error codes after a while reported by OpenCL (which I had no clue was a thing) and I get some code saying the program was not created properly (to run the kernel). No fucking clue what's up with that. Google around, find another tutorial, rewrite my code in case I'm using outdated code or something. Nothing.
Fast forward an hour, I find out that OpenCL has logs! So I grab some code from the website I found it on, and voila, I finally get some info on what's going on.
Get a load of this bs.
In the kernel file, so that OpenCL knows that it's a function to run, you have to put __kernel. But in all the places I read, it said to put it as _kernel.
Add the underscore, compile, run and everything is perfect.
Then I tried just putting 'kernel'. Also compiles and runs fine.
Two hours hours and my program was fixed by adding an underscore. IF ONLY C++ GAVE AN INDICATION OF WHAT BLEW UP INSTEAD OF SITTING BACK AND BEING LIKE "oh wow man feels bad, work some magic and try again" THEN THIS WOULD NOT HAVE TAKEN SO LONG.
Then again, it was OpenCL that was being shitty with its styling enforcement or whatever the hell the underscore business is. But screw it. C++ eats shit too for this. Sure, maybe Java babies you by giving you the exact error and position that the error took place at. But at least that way you don't waste hours of your life chasing invisible bugs 😠😠
I'm going to eat some food... Too much energy was consumed fighting the system... Then I'll get back to OpenCL because 😇 but that doesn't make it less bs.1
may do an extreme rpi project…
is a self driving go kart or self flying drone cooler?
and for the drone, i think it would be easier, what do you guys think?
please answer - also for the drone, is there a way i could get it to connect from anywhere (within reason)? i know if it were a cell phone, i could get a signal from anywhere, but i don't want to pay for a monthly plan.4
It's 2 AM, and I need to get to sleep.
I am not wanting to compile OpenCL for my Pi in the hopes that it helps this go any faster, but I also don't want to waist my time waiting for this to go.
My current dilemma.1
As a project for our computational fabrication course, I implemented a paper with a peer. We did it in python because I didn't want him to suffer with lower level stuff, but then it runs sooo slow.
And I'm just itching, dying to OpenCL/CUDA the shit out of this code, because it's so parallelizable it's a sin not to do it.
But it's really out of the scope for the course, not worth the effort, and I have tons of other stuff to do now.
I miss being paid to make these sort of algorithms efficient 😭
Motion tracking tool that tracks affine transformations, as well as perspective, given a defined shape by the user. Runs slow as fuck compared to the ones out in the market, but hey, it works. Currently, I'm figuring out how to ship computation to the GPU, though I'm not well versed in OpenCL, since cross platform is more of a priority.
someone brought something to school today, a "ac receiver" or "av receiver" or something? he pointed it at the board and turn it off, and i heard he opened someone's email with it? does anyone know what this could be?6
making a self driving go kart controlled with a rpi, should i use python, java, dart, or something else? python seems like the obvious choice.
i plan on making it have google maps integrated, with netflix and music player, with a touchscreen.
i was thinking c++, but a gui with c++ didn't seem ideal.
what would you use?
also is an rpi too slow to make the go kart be *relatively* safe?3
Now that the RX480 is out, I'm crying I can't afford, but do you guys know where I can find openCL benchmarks?
so I offered to help a guy with his startup idea which is in the making for a year at least. (A telemetry data collection device, mind you). It's an unpaid internship with no strings attached, no contract, mind you.
I am nowhere near the programming pro like most of you guys here, so that's what I want to focus on improving.
First thing he tells me to do is a market research on competitors.... I thought I left that bullshit behind when I left business school..
If I want to work without getting paid, I'd rather stay at home and learn c++ and opencl, and work on the MSc thesis full time, thanks.
Do you think it's the right thing to do or should I give it time?10