Are there asynchronous parallel examples?
See original GitHub issueI have a function that needs to be evaluate remotely
evaluate(parameter, server_id):
# send `parameter` to server based on `server_id`
return {'metric': (res, 0)}
For instance, I have 5 servers and want to optimize the metric in parallel. Currently the only way I could think of is to run the following :
import multiprocessing as mp
ps=[]
for i in range(5):
parameters, trial_index = ax_client.get_next_trial()
p = mp.Process(target=evaluate, args=(parameters, i))
p.start()
ps.append(p)
for i in range(5):
ps[i].join()
# retrieve data
ax_client.complete_trial(trial_index=trial_index, raw_data=retrieved_data)
This is actually synchronous, which is less efficient. Is there a way to construct an asynchronous parallel evaluation?
Issue Analytics
- State:
- Created a year ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
The difference between Asynchronous and Parallel - Medium
Visual Studio magazine defines 'Asynchronous Programming' as “… a means of parallel programming in which a unit of work runs separately from the ......
Read more >How to articulate the difference between asynchronous and ...
Async and Callbacks are just a mechanism that allows the programmer to express concurrency. Consider that well-known parallel programming design ...
Read more >Asynchronous versus parallel versus concurrent programming
Asynchronous programming involves some calculations time-intensive tasks, which on the one hand are engaging a thread in the background but do not affect...
Read more >Asynchronous Parallel Programming | SpringerLink
Asynchronous parallelism is the most general form of parallelism, whereby processors operate freely on tasks, and global synchronization is not required. In ...
Read more >Asynchronous and Parallel Programming - C# Corner
This article provides a basic understanding of the two hot topics, asynchronous programming and parallel programming irrespective of the ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @deng-cy thank you for reaching out! Your use case may be a good candidate for our Scheduler API, which has a tutorial here.
It involves a little more overhead to set up compared to the Service API, you will define a Runner object to send trials to your external system and Metric objects to retrieve the data once the trial has been run, but it gives you the ability to set maximum parallelism (among other settings) and allow Ax to handle scheduling, new point generation, and trial deployment and polling for you automatically. Personally this is my favorite way of using Ax as it allows the user to “set it and forget it”, which I find more than worth the effort in setting the Scheduler up for most experiments.
If you need any assistance setting this up or any other questions with your specific use case please feel free to continue to respond in this thread.
@sgbaird Yeah Service API, I corrected it.