Unknown
BTW you could have find with a google search...
Yes I knew it but I was just confirming and I have also personally tested these algorithms.
Leinier
Use openmp
I think that can be done with a simple algorithm. I don’t want to complicate things. And the goal is simple: to process files in parallel and store the results in a database
Leinier
trying to tell you that works fine. look at this portion: #ifdef _ _ linux _ _ /* * Get total number of CPUs */ _systemCPUs = sysconf(_SC_NPROCESSORS_CONF); #else _systemCPUs = 1; #endif // _ _ linux _ _
Leinier
that works fine, my custom_namespace::_variables too
Leinier
that's what i'm trying to tell you
Leinier
sorry, old messages sent now
Mihail
that works fine, my custom_namespace::_variables too
They work, but they aren't guaranteed too
Leinier
Also what happens if filesQueue.size() is >= to _configuration.filesProcessingThreads()
that will never happen because 'filesQueue' starts empty, and '_configuration.filesProcessingThreads()' will always greater than 0
Daniele°
#pragma omp parallel for for(size_t i=0; i<10;++i){ puts("hello"); } Automatic crete thread and parallelize for
Daniele°
Openmp is standard de facto to parallelize a process
Mihail
that works fine, my custom_namespace::_variables too
Tommorow libstdc++ might add a class/function/namespace called _configuration and your code will break. That's what I'm trying to tell you
Leinier
Tommorow libstdc++ might add a class/function/namespace called _configuration and your code will break. That's what I'm trying to tell you
you're right, but once again, i defined a custom namespace in my project, so, i think that all my variables are and will be unique
Leinier
an example: namespace odimu { namespace configuration { class Configuration; } extern configuration::Configuration _configuration; } so, everybody must use odimu::_configuration, or define the namespace odimu and then use _configuration directly
Mihail
Also I really don't see why you insist on that _ being there
Leinier
Probabily all your code can be replaced with only One or two pragma directive
i'll take a look at concurrent library from boost and openmp as well
Mihail
that will never happen because 'filesQueue' starts empty, and '_configuration.filesProcessingThreads()' will always greater than 0
Yeah but you have that 500ms sleep (why?). So what would happen if 5 files get added to the queue during that period and your processing threads are 4
Leinier
Yeah but you have that 500ms sleep (why?). So what would happen if 5 files get added to the queue during that period and your processing threads are 4
Because the file peocessing takes some time, so, once I start all available slots for file processing I want to sleep for a while and let the threads work and do not use all cpu constantly checking if some thread finished in order to start another one
Mihail
Also 500ms is a very long time
Mihail
What are you processing?
Leinier
What are you processing?
Multimedia files, i.e: movies, tv shows, reality shows. Files greater than 1GB
Mihail
Ok then yeah
BinaryByter
ever thought of trying DMA?
Leinier
why use a separate thread then?
Because I want multiprocessing in order to gain processing speed. I know my software will run on a multicore pc or professional server with more than 16 cpu threads
BinaryByter
if your CPU is idle while waiting for the other thread, multiprocessing is stupid anyway
Mihail
while (!filesQueue.empty()) { cleanProcessedFiles(); for (unsigned short i = 0; i < filesQueue.size(); i++) createNewFileProcessing(); sleepFor(milliseconds(500)); } @leiniercs What about this?
Mihail
Like if you're sure that the condition in that if is met why have it there?
Leinier
So again what would happen if I add 5 files to the queue during that 500ms period
That will be on the queue until the previous added files finished. That’s the goal. I run a library scan, it discover all multimedia files within a directory and add all of them to the fileProcessingQueue, then, there is a separate thread that checks if there are files in the queue and execute their processing simultaneously (with the limit defined in the configuration)
Mihail
Also once you create a process for all your files filesQueue.empty() would be true and you'd go out of that while. That doesn't sound like what you're trying to do tho
数学の恋人
Why is this (the highlighted line) wrong?
数学の恋人
What's the error?
no matching function for call to ‘stoi(__gnu_cxx::__alloc_traits<std::allocator<char> >::value_type&)’
数学の恋人
Why is this (the highlighted line) wrong?
is this readable, if not I'll try to send a clear one.
数学の恋人
And what's the expected input of std::stoi?
binary contains only 0 and 1 but as strings
Mat
That's not the answer to my question 🤔
数学の恋人
And what's the expected input of std::stoi?
a string which has numbers as chars
Mat
a string which has numbers as chars
And what's the type of temp_binary[j]?
Mihail
std::string
That's your issue
数学の恋人
Oh got you
Mat
Thanks
No problem :)
数学の恋人
wait but temp_dec is int
Mihail
wait but temp_dec is int
Yes but you're giving stoi a char
Mat
std::string
You're getting the j-th char from temp_binary
数学の恋人
Yeah
Mat
It's char, not std::string the right answer
数学の恋人
nothing
数学の恋人
I got you
数学の恋人
What I did wrong was, converting a char into int with stoi
Mihail
If you want the individual 0 or 1 simply subtract '0' from the char
数学の恋人
so temp_binary[j]-'0' will give an integer right?
数学の恋人
At the same time
Mihail
Also you're overwriting temp_dec everytime
数学の恋人
Yes, that I know
数学の恋人
I'm doing that purposely
Mihail
If you only want the last one then only get the last one
数学の恋人
one more doubt.
数学の恋人
How can I append a character to a string?
数学の恋人
like a string I can append with str.append("the string"); but how a character
Ludovic 'Archivist'
What is faster in between these in case of arrays ? 1.merge sort 2.selection sort 3.insertion sort
Completely depends on your data, if it is nearly sorted, a bubble sort will be faster than a merge sort
Riccardo
Guys I know this is a C++ group but what do you think about Rust??
BinaryByter
Since the BOUNDS opcode is deprecated in x86_64 it doesnt bear more potential than C++ :(
BinaryByter
otherwise, its kinda more secure
BinaryByter
but not as well supported