logo
down
shadow

Disabling multi core programmatically


Disabling multi core programmatically

By : user3851453
Date : October 16 2020, 11:12 PM
will be helpful for those in need I think some workaround can be in setting affinity for main thread of your task for one core, than create threads with infinite loops for other cores and set them highest possible priority. But usually somthing wrong is in software if it cannot run on multicore hardware.
code :


Share : facebook icon twitter icon
How can I determine programmatically whether on multi-core, hyperthreading or multi-processor?

How can I determine programmatically whether on multi-core, hyperthreading or multi-processor?


By : ashish dhingra
Date : March 29 2020, 07:55 AM
around this issue System.Environment.ProcessorCount Which will also include hyperthreaded processors. Which Vmware may or may not expose. Chances are higher that it will be exposed if the the processor is VT enabled AND you are using a baremetal enabled hypervisor technology.
If you have XP-SP3/WIN2k3 or above You can use WMI to pull out:
code :
Win32_ComputerSystem.NumberOfProcessors returns physical count

Win32_ComputerSystem.NumberOfLogicalProcessors returns logical count
Can I programmatically pick and choose which core of a multi-core CPU my thread should run on?

Can I programmatically pick and choose which core of a multi-core CPU my thread should run on?


By : user1607837
Date : March 29 2020, 07:55 AM
I wish this helpful for you For linux os, sched_setaffinity is your answer. It's supported since linux kernel 2.5.8.
Name
code :
#define _GNU_SOURCE
#include <sched.h>

int sched_setaffinity(  pid_t pid,
    size_t cpusetsize,
    cpu_set_t *mask);

int sched_getaffinity(  pid_t pid,
    size_t cpusetsize,
    cpu_set_t *mask);
Multi-part question about multi-threading, locks and multi-core processors (multi ^ 3)

Multi-part question about multi-threading, locks and multi-core processors (multi ^ 3)


By : Monique
Date : March 29 2020, 07:55 AM
this one helps. The potential contention with CrossBlend is set1 - the destination of the blend. Rather than using a lock, which is going to be comparatively expensive compared to the amount of work you are doing, arrange for each thread to work on it's own destination. That is a given destination (array at some index in set1) is owned by a given task. This is possible since the outcome is independent of the order that CrossBlend processes the arrays in.
Each task should then run just the inner loop in CrossBlend, and the task is parameterized with the index of the dest array (set1) to use (or range of indices.)
Multi-thread process on multi-core or single-core double the speed?

Multi-thread process on multi-core or single-core double the speed?


By : Paul coder
Date : March 29 2020, 07:55 AM
Any of those help Ideally independent 2 tasks running on unideal OS like Windows 2012 will run faster on 2 cores at 1.5GHz, than on 1 core at 3GHz due to elimination of thread context switching overhead.
Unfortunately, there are very very few ideally independent tasks.
OpenMP detects only a single core on multi-socket/multi-core system

OpenMP detects only a single core on multi-socket/multi-core system


By : Kit
Date : March 29 2020, 07:55 AM
it fixes the issue I answer my question.
My program sets the CPU affinity of the main thread as follows:
code :
CPU_ZERO(&cpuset);
CPU_SET(0, &cpuset);
pid_t tid = (pid_t) syscall(SYS_gettid);
sched_setaffinity(tid, sizeof(cpu_set_t), &cpuset);

unsigned long mask = -1;
int rc = sched_getaffinity(tid, sizeof(unsigned long), (cpu_set_t*) &mask);
if (rc != 0) {
  std::cout << "ERROR calling pthread_setaffinity_np; " << rc << std::endl;
  abort();
}
Related Posts Related Posts :
  • How to find the magic number of a file by just provding the path of the file using c++?
  • How to export function names and variable names using GCC or clang?
  • What is the quickest way to print a 2D array of chars?
  • Should a call to WSAResetEvent after WSAEnumNetworkEvents cause event to never be set again?
  • File pointer only read the first entry
  • Using alias from header file in corresponding source file
  • Can I Initialize a char[] with a Ternary?
  • C++ Metaprogramming: Generating a byte sequence based on type/value input?
  • Scope of an object created inside if-condition?
  • Process std::map<K,V> and std::map<K,V*> in similar way
  • Windows Sensor API - Unresolved external symbol for CLSID
  • Matlab trigonometric functions
  • C++: Cannot compare double from an array of structures to another double in if function
  • Uniform initialization causes runtime error in C++
  • Sum of partial group of {^(0),(1),……,()}
  • Template in a Template of a different types problem
  • Undefined symbol boost::system:detail::system_category_instance
  • Access to a string member in C++
  • Template: How to select smallest int type which holds n bits?
  • Passing command line arguments to Visual Studio using CMake for profile guided optimization
  • Start multiple threads and wait only for one to finish to obtain results
  • Shall structured binding to a copy of a const c-array be const?
  • Meyers Singleton : static keyword confusion
  • every data type reserves a memory or address in array but why don't comma(,) reserve its memory in an array
  • c++ std::vector of functions passed as a parameter of a class method
  • Default parameters in constructor gives compile time errors
  • C++ set iterator error: no match for ‘operator+=’
  • Can I get the size of a dynamicly allocated array the way `delete[]` does?
  • properly rendering an SDL rectangle to the screen
  • STL not release memory from System level
  • Passing multidimensional array back through access members
  • About GDI/GDI+ coordinate compatibility?
  • What's the difference between these two object instantiation approaches?
  • How could a member method delete the object?
  • whats wrong with this program
  • Using .lib and .dll files in Linux
  • how to define a class using c++
  • C++ How to read in a text file and reverse the lines so it reads from bottom up
  • how do i make this so everything can use it? C++
  • Exporting a C++ class from a .SO ( linux )
  • intellisense for empty Win32 projects
  • Parsing mathematical functions of custom types
  • Android play raw Audio from C++ side
  • How to access Active Directory using C++Builder?
  • String statements
  • Instruction-Level-Parallelism Exploration
  • Select from SQLite with Qt
  • Dynamic Memory Allocation
  • Maximum number of characters in a string
  • Float Values as an index in an Array in C++
  • Is 'using namespace std;' a standard C++ function?
  • Building a suffix tree in C++
  • Passing ifstream to a function in C++
  • Where would you use a friend function vs. a static member function?
  • Invalid free while performing a std::string assign with -O2 set in g++
  • Shutting down multithreaded NSDocument
  • C(++) malloc confusion
  • Portable c++ atomic swap (Windows - GNU/Linux - MacOSX)
  • C++ array initialization
  • How (i.e. what tool to use) to monitior headers sent by Curl (Cookie problem)
  • shadow
    Privacy Policy - Terms - Contact Us © bighow.org