threadpool

TensorFlow Execution on a single (multi-core) CPU Device

心不动则不痛 提交于 2019-12-03 10:17:47
问题 I have some questions regarding the execution model of TensorFlow in the specific case in which there is only a CPU device and the network is used only for inference, for instance using the Image Recognition(https://www.tensorflow.org/tutorials/image_recognition) C++ Example with a multi-core platform. In the following, I will try to summarize what I understood, while asking some questions. Session->Run() (file direct_session.cc) calls ExecutorState::RynAsynch, which initializes the

Why does a ScheduledExecutorService not run a task again after an exception is thrown?

。_饼干妹妹 提交于 2019-12-03 09:37:23
For executing periodical tasks, I looked at Timer and ScheduledThreadPoolExecutor (with a single thread) and decided to use the latter, because in the reference for Executors.newSingleThreadScheduledExecutor() , it says: Note however that if this single thread terminates due to a failure during execution prior to shutdown, a new one will take its place if needed to execute subsequent tasks. My plan was to use this as a safeguard against uncaught exceptions in a watchdog piece of code that I want to monitor other operations. I wanted to make sure and wrote the test below, which promptly failed.

Java Executor Service Thread Pool [closed]

感情迁移 提交于 2019-12-03 09:12:47
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center . If I create a fixed size thread pool with 10 threads in java using Executor framework: private final ExecutorService pool; pool = Executors.newFixedThreadPool(10); and then try to submit more than 10 tasks (say for an example, 12 tasks); for (int i = 0 ; i < 12 ; i++) { pool.execute(new Handler(myRunnable)); } What will happen to the

How to pin threads to cores with predetermined memory pool objects? (80 core Nehalem architecture 2Tb RAM)

两盒软妹~` 提交于 2019-12-03 09:04:47
问题 I've run into a minor HPC problem after running some tests on a 80core (160HT) nehalem architecture with 2Tb DRAM: A server with more than 2 sockets starts to stall a lot (delay) as each thread starts to request information about objects on the "wrong" socket, i.e. requests goes from a thread that is working on some objects on the one socket to pull information that is actually in the DRAM on the other socket. The cores appear 100% utilized, even though I know that they are waiting for the

ThreadPool vs dedicated Thread - when to prefer which

谁说我不能喝 提交于 2019-12-03 09:02:34
Is there any way (apart form actual perfomance measurements which can be pretty hard to make them realistic) or rule of thumb when I should stop using the ThreadPool and use a dedicated Thread instead? I suppose for long running work it is better to use a dedicated Thread because it doesn't peramently steal one from the ThreadPool . For shorter work it is better use the the ThreadPool because creating threads and the thread itself consumes a lot of resources. But where is the magic barrier? How do I decide which approach to use? In simple applications it might not matter that much. But I am

Creating a dynamic (growing/shrinking) thread pool

为君一笑 提交于 2019-12-03 08:56:32
问题 I need to implement a thread pool in Java (java.util.concurrent) whose number of threads is at some minimum value when idle, grows up to an upper bound (but never further) when jobs are submitted into it faster than they finish executing, and shrinks back to the lower bound when all jobs are done and no more jobs are submitted. How would you implement something like that? I imagine that this would be a fairly common usage scenario, but apparently the java.util.concurrent.Executors factory

Using JMS or ThreadPool to send email messages

帅比萌擦擦* 提交于 2019-12-03 08:40:38
I will like to know: I have a scenario. If a user adds a product to the system (I'm developing), there's a listener that sends a notification to the user's client base notifying of a new product added by the user. I've read this thread and (seeing I've never used JMS nor ThreadPool before) I was wondering whether I should use JMS or ThreadPooling. I am using Tomcat 5.5 and higher and JBoss 5 and higher (depending on company last resort) to deploy my web application. If I use JMS, do I use Apache ActiveMQ or JBoss Messaging ? Are they both compatible to run on both platforms (Tomcat and JBoss)?

.Net How to create a custom ThreadPool shared across all the AppDomain of a process?

核能气质少年 提交于 2019-12-03 08:33:05
I made a custom ThreadPool optimized for my specific needs. However, when there are multiple AppDomains in the process, the CLR ThreadPool is able to be shared across all the AppDomains and I would like to be able to reproduce this behavior. This could be done using MarshalByRefObject and Remoting in order to create a distributed ThreadPool, but I fear that it will add unwanted overhead since the key goal of the custom thread pool is performance. Another theoretical solution would be to hack the AppDomain memory boundary using an unmanaged object. If I'm correct, the memory boundary in

Multiprocessing pool 'apply_async' only seems to call function once

Deadly 提交于 2019-12-03 08:30:48
I've been following the docs to try to understand multiprocessing pools. I came up with this: import time from multiprocessing import Pool def f(a): print 'f(' + str(a) + ')' return True t = time.time() pool = Pool(processes=10) result = pool.apply_async(f, (1,)) print result.get() pool.close() print ' [i] Time elapsed ' + str(time.time() - t) I'm trying to use 10 processes to evaluate the function f(a) . I've put a print statement in f . This is the output I'm getting: $ python pooltest.py f(1) True [i] Time elapsed 0.0270888805389 It appears to me that the function f is only getting

Best way to report thread progress

强颜欢笑 提交于 2019-12-03 07:51:43
I have a program that uses threads to perform time-consuming processes sequentially. I want to be able to monitor the progress of each thread similar to the way that the BackgroundWorker.ReportProgress / ProgressChanged model does. I can't use ThreadPool or BackgroundWorker due to other constraints I'm under. What is the best way to allow/expose this functionality. Overload the Thread class and add a property/event? Another more-elegant solution? Overload the Thread class and add a property/event? If by "overload" you actually mean inherit then no. The Thread is sealed so it cannot be