Message Boards Message Boards

A WebServer in top-level Wolfram Language with Foreign Function Interface

Posted 1 year ago
4 Replies
Posted 1 year ago

I think you can use LinkCreate to

  1. Exchange data with the parallel kernel via WSTP
  2. To have a possibility to stop the process completely

But then in this case there will be a big overhead related to work via WSTP, so there are some disadvantages here too. In fact, I thought over many variants when I was writing my implementation and came to the conclusion that minimalistic C implementation will be the most efficient.

POSTED BY: Kirill Belov

Yes, these are both good approaches. I also came to the conclusion that, in general, there is no escaping writing C code (or something like it) for launching asynchronous tasks.

As for ParallelSubmit etc., I did get an example working with LocalSubmit, though it took a bit of finagling. You can find it under the scope section here: https://resources.wolframcloud.com/PacletRepository/resources/ChristopherWolfram/WebServer

I also had problems killing the LocalSubmitted task, or getting it to share variables with the main kernel, which sort of defeats the purpose.

enter image description here -- you have earned Featured Contributor Badge enter image description here Your exceptional post has been selected for our editorial column Staff Picks http://wolfr.am/StaffPicks and Your Profile is now distinguished by a Featured Contributor Badge and is displayed on the Featured Contributor Board. Thank you!

POSTED BY: EDITORIAL BOARD
Posted 1 year ago

Great post and paclet! Glad someone else found my code useful! I know how to make the function that will not block the kernel.

  1. To do this you would have to create an asynchronous task directly on the C side, but then the very idea of writing a server only in a top-level language is already broken.
  2. You could just make the server run by default on a parallel kernel with ParallelSubmit/LinkCreate and return a task that can be stop the server if it necessary.
POSTED BY: Kirill Belov
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract