ok so i get what you mean, but if i increment by the number of threads then each thread is just going to skip an iteration and they'll share the same iterations, right?
There are a number of ways to do it, you can split your data into num_thread sections, and give each thread num_data/num_threads iterations to do. T0: 0,1,2 T1: 3,4,5 T2; 6,7,8. Or iterate by num_threads, so in three threads t0:0,3,6; t1:1,4,7; t2:2,5,8
ah that makes sense, thanks so much!
ok i promise this is my last question on it
i currently create my threads like so
readParams->start = 0;
for (int i = 0; i < numThreads; i++) {
readParams->start++;
rc = pthread_create(&thrdid[i],NULL,sub,(void*)readParams);
my idea here is that start is the thread number (starting at 1 for reasons)
now ideally when i go into my thread each thread would have their number via start which is where they would start iterating through the array
the issue with this idea is that each thread is only getting the last thread's start value
so if i have 1 thread it works perfectly, thread 1 gets the start value of 1, but if i have 2 threads then both threads get the start value of 2
this sounds like a synchronization issue but i can't figure out how to solve it, would a barrier_wait be able to stop them from overlapping?
You could create copies of your readParams struct inside the loop so they would have different start values. Then each thread wouldn't have the last created threads start id.
so are you saying for each thread create a new pointer to the struct like so?
void* sub(void *arg) {
struct threadParams *readParams = malloc(sizeof(struct threadParams));
readParams = (struct threadParams *)arg;
threadParams->start++;
double difference = 0;
double maxDifference = 0;
int count = 0;
int test = 1;
while (test) {
difference = 0;
//printf("%d\n",start);
for (int row = readParams->start; row < readParams->numRows-1; row += readParams->numThreads) {
for (int col = 1; col < readParams->numCols-1; col++){
readParams->hotPlateCopy[row][col] =
((readParams->hotPlate[row-1][col] +
readParams->hotPlate[row+1][col] +
readParams->hotPlate[row][col+1] +
readParams->hotPlate[row][col-1]) / 4.0);
maxDifference = fabs(readParams->hotPlate[row][col]
-readParams->hotPlateCopy[row][col]);
if (maxDifference > difference)
difference = maxDifference;
}
}
pthread_barrier_wait(&barr);
for (int row = 1; row < readParams->numRows-1; row++) {
for (int col = 1; col < readParams->numCols-1; col++) {
readParams->hotPlate[row][col] = readParams->hotPlateCopy[row][col];
}
}
//pthread_barrier_wait(&barr);
if (difference < readParams->epsilon) {
if (count != 0)
printf("\t%d\t %f\n", count, difference);
break;
}
if (isPowerOfTwo(count) && count != 0) {
printf("\t%d\t %f\n", count, difference);
}
count++;
}
}
i feel like the issue would persist but i could be misunderstanding
Store a pointer to the arrays not the actual array in the struct.
im so dumb lmao
i've got it pretty much working now, just gotta work on the synchronization and i should be gucci
you're a boss
Having a bit of trouble with how Websocket-sharp (net standard) handles Refused Connections.
What would happen, if our webserver was down, it would print an error to the console. But I can't even catch this to handle anything. The application just ends up running forever due to keepalive, but since I can't catch the error, I can't attempt a reconnection
https://files.facepunch.com/forum/upload/1755/960eb063-7812-4912-acad-1a691a97d879/image.png
https://files.facepunch.com/forum/upload/1755/356b8f92-14fc-4305-8b1d-c25bebada4ac/image.png
Libarary feels laughably unmaintained, so is the best solution just to edit and compile this from source, or is there some advanced error catching technique I haven't heard about that can override whatever bullshit this throws me
I've never used that library, but I had a quick glance at the GitHub page and you could possibly use ConnectAsync and manage the timeout yourself
I just use Prettier and it auto adjusts when I save. I also brought this into our some of our projects at work. Saves lots of time between developers & different editors.
I initially put it into a async task, but turns out that doesn't work for void.
so just calling it from ws.ConnectAsync(), sort of worked
https://files.facepunch.com/forum/upload/1755/21ad78bb-a662-4d47-8da1-76f1800d2e18/image.png
But not really
https://files.facepunch.com/forum/upload/1755/b5bec3a8-f092-471a-87f6-e3474885c593/image.png
Unity build process question:
If you can't use unity cloud to build, what is a good way of handling building for multiple platforms?
I am currently building for both iOS and Android. Building doesn't really take a huge amount of minutes, but switching platform does.
Can I do something smarter with switching platform? As far as I know, cloud build isn't an option due to the amount of odd dependencies we have.
Would appreciate some feedback on the general design here.
Icon will vary based on notification.
https://i.imgur.com/xPoD0SY.png
i think that's a very wide notification box. I think most people will just click on notification to dismiss it and what's being shown isn't super simple to glance at tbh
i share the complaint on the width, also can you center the little arrow with the bell's string thing please i'm begging you do it
Adding to buhbang, people like glancing over these.
Now, I don't use the service, so I don't know what your plans are for notifications.
Try to copy what other services to, replace the bell glyphs where possible for a more immediate identification.
So like, if your notification was to alert that some team had done something, you'd instead display their logo. People would glance over these and see said logo, and judge on how important each item is
Twitch's notifications aren't that expansive, but they're pretty dead on regarding their design.
https://files.facepunch.com/forum/upload/1755/ee5cad90-8f41-4b12-83c8-f0bc40ab873c/image.png
Any generic notifications would fall back to a standard, or even tailored glyph.
Regards to width, 400px is about what to expect, you could push that a little, but clealy not as much as you have
Not sure if this is the right area to ask but uh... I need help finding someone who can code who could tell me what type of coding I would need for this. I'm trying to re-establish a old game and make it work multiplayer, I got all the core game files I believe but It needs like a master server and such. (If this is the wrong place for this just tell me I can just wipe and try somewhere else. I didn't know. :V )
You would likely need to recode a lot of things to make it performant for network communication. What language is the game in?
I think in C++?
A kinda noobish question, but still... I'm working on a hobby project in C# / LiteDB and I have following problem:
I have a World, in this world I have a List<Country> of countries
and these countries have a List<City> of cities like this:
World
├─Country 1
│ ├── City 1
│ └── City 2
│
│
├─Country 2
│ └──City 3
...
Creating this is pretty easy, so is adding to it. But how do I store it in a Database?
Right now I'm using LiteDB which is a document store.
Do I only store the World as a single Object or should I story all the countries and cities and somehow link them, which sounds like the better solution?
I've never worked with databases before, this is a learning project for me. So If you have any help or could point me to some useful resources that would be great!
If anyone wants 30 coins, please help solve my Unity Editor serialization/drawing issue: How do you create a serializable list of classes implementing an..
Anyone have any experience using sparse textures in OpenGL?
In my particular case, I want a single monolithic Texture_2D_Array for all model textures.
If I were to use the standard memory model, I would have to make it huge and allocate all of the memory at once.
However if I were to use sparse textures, it would only really be using memory for each page I commit to it.
I'm having trouble finding useful information on the subject.
Can I treat each layer (ie each image in the texture array) as a page in itself, or do I have to subdivide it down into tiles or something?
Making a game in Unity for mobile, I have a UI button to switch scenes, but while working in the Editor, the button does not work on my phone. Anyone else that encountered the problem?
Hey all.. Just curious, is this thread for coders only or can non-coders make requests for extracting game archives??
"What do you need help with" is for solving problems yourself, not requests. If you were personally trying to code a tool to extract the data, have at er. But no requests.
Anyone know of any open sorbet audio playback libraries? I'm looking to add sound to my engine.I'm looking to do simple sounds, but eventually would like to try spatial sounds too
OpenAL is a good one, but it doesn't support loading any filetypes other than WAV, so you'll have to get an OggVorbis or MP3 decompressor somewhere else.
So I'm learning blueprints and I've run into an issue that I can't quite wrap my head around.
I'm trying to execute a while loop whenever a certain condition turns up false. The loop is comprised of interpolating a vector from whatever value it is to 0,0,0, and as long as the vector isn't 0,0,0 the loop continues.
The only issue is that Unreal is lying to my face, saying the vector IS equal to 0, even when it isn't, keeping my loop from ever getting a chance to run:
https://files.facepunch.com/forum/upload/216394/2e301585-4103-42d5-b314-2c9c0b6f63ef/Why.jpg
So this is my first post on this new account I guess. Idk how to login to the old one now.
This is annoying me:
[ERROR] addons/myaddon/lua/autorun/ddl_zedlvl_cvar.lua:24: ')' expected (to close '(' at line 3) near 'local'
1. unknown - addons/myaddon/lua/autorun/ddl_zedlvl_cvar.lua:0
because here is line 24:
local zNewLevel = 1
here is line 3
local zNewLevel = 1
lines 1 and 2 are white space. Idk what line 0 means...
To note, this wasn't happening before the latest update.
Sorry, you need to Log In to post a reply to this thread.