dohashi

1172 Reputation

10 Badges

14 years, 348 days
I am a Senior Software Developer in the Kernel Group, working on the Maple language interpreter. I have been working at Maplesoft since 2001 on many aspects of the Kernel, however recently I have been focusing on enabling parallel programming in Maple. I have added various parallel programming tools to Maple, and have been trying to teaching parallel programming techniques to Maple programmers. I have a Master's degree in Mathematics (although really Computer Science) from the University of Waterloo. My research focused on Algorithm and Data Structure, Design and Analysis.

MaplePrimes Activity


These are replies submitted by dohashi

 

Except for a bit of lag when first starting, this seems to work:

Download 122_timer.mw

Darin

-- Kernel Developer Maplesoft

 

You should be able to call SetProperty from the background thread.  Just put your code in place of the print( st )

Darin

-- Kernel Developer Maplesoft

 

You should be able to call SetProperty from the background thread.  Just put your code in place of the print( st )

Darin

-- Kernel Developer Maplesoft

 

When I run your code on my actual multi-core machine, I do see interlaced output:

                                 "thread 2: time = .746"

                                 "thread 1: time = .746"

                                "thread 2: time = 2.857"

                                "thread 1: time = 4.861"

                                "thread 1: time = 6.865"

                                "thread 2: time = 8.870"

                                "thread 2: time = 10.875"

                                "thread 1: time = 12.879"

                                "thread 2: time = 14.882"

                                "thread 1: time = 16.886"

Here is my best guess to why you aren't seeing interlaced output.  The system call is executed by the client (cmaple or the GUI), not in the kernel itself.  Communication between the kernel and the client is synchronized, so while the system call is executing another thread has to wait to send its system call to the client.  However once the first thread's sleep is over, the amount of time it spends in the kernel is very short, so it makes it back into the system call before the other thread wakes up (because you are on a single core machine), blocking the other thread once again.  Thus one thread manages to monopilize the client interface while the other thread is stuck waiting.

Once the first thread is done, the other thread can finish.

Now as for why printf works when print doesn't.  I think this has to do with how printf works.  printf sends multiple messages to the client, thus is locking and unlocking more frequently.  My guess is this allows the second thread a better chance of waking up and being able to get its system command to the client.

Darin

-- Kernel Developer Maplesoft

 

When I run your code on my actual multi-core machine, I do see interlaced output:

                                 "thread 2: time = .746"

                                 "thread 1: time = .746"

                                "thread 2: time = 2.857"

                                "thread 1: time = 4.861"

                                "thread 1: time = 6.865"

                                "thread 2: time = 8.870"

                                "thread 2: time = 10.875"

                                "thread 1: time = 12.879"

                                "thread 2: time = 14.882"

                                "thread 1: time = 16.886"

Here is my best guess to why you aren't seeing interlaced output.  The system call is executed by the client (cmaple or the GUI), not in the kernel itself.  Communication between the kernel and the client is synchronized, so while the system call is executing another thread has to wait to send its system call to the client.  However once the first thread's sleep is over, the amount of time it spends in the kernel is very short, so it makes it back into the system call before the other thread wakes up (because you are on a single core machine), blocking the other thread once again.  Thus one thread manages to monopilize the client interface while the other thread is stuck waiting.

Once the first thread is done, the other thread can finish.

Now as for why printf works when print doesn't.  I think this has to do with how printf works.  printf sends multiple messages to the client, thus is locking and unlocking more frequently.  My guess is this allows the second thread a better chance of waking up and being able to get its system command to the client.

Darin

-- Kernel Developer Maplesoft

Maple does not connect to the operating system kernel, except via standard API calls. The core Maple evaluation engine is contained in an executable we refer to as "the kernel". The Maple GUI connects to the Maple kernel. Darin -- Kernel Developer Maplesoft
The DAG classes have private constructors. To create objects use the exports of the Engine object. This style of construction is used because the Maple engine is required to create a DAG. Java OpenMaple does not currently have objects for all the DAG types, which I agree is a shame. Actually what I think might be even more useful would be adding functions like add, multiply and power to the Algebraic class. That would make it much easier to form complex DAGs. op would probably be a good function to add as well. It is not clear what you would do with (for example) a sum dag that you could not do with a Algebraic. I guess if you constructed the dag then you could control the evaluation better. How would you suggest creating a procedure? (Note it is not a function call) I think that the use of a string, (thus Maple syntax) is pretty natural. Procedure.execute allows one to form and evaluate a function call. Algebraic.eval on the procedure will evaluate the procedure DAG. As for the expression sequence thing, if you notice, an expression sequence can only be assigned to before unique is called. This allows one to construct an expression sequence without having to have all the Algbraics pre-computed. So you can create an expression sequence in a for loop. There are also some instances, like in Procedure.execute where an array of algebraics can be used in place of an expression sequence. Darin -- Kernel Developer Maplesoft
The DAG classes have private constructors. To create objects use the exports of the Engine object. This style of construction is used because the Maple engine is required to create a DAG. Java OpenMaple does not currently have objects for all the DAG types, which I agree is a shame. Actually what I think might be even more useful would be adding functions like add, multiply and power to the Algebraic class. That would make it much easier to form complex DAGs. op would probably be a good function to add as well. It is not clear what you would do with (for example) a sum dag that you could not do with a Algebraic. I guess if you constructed the dag then you could control the evaluation better. How would you suggest creating a procedure? (Note it is not a function call) I think that the use of a string, (thus Maple syntax) is pretty natural. Procedure.execute allows one to form and evaluate a function call. Algebraic.eval on the procedure will evaluate the procedure DAG. As for the expression sequence thing, if you notice, an expression sequence can only be assigned to before unique is called. This allows one to construct an expression sequence without having to have all the Algbraics pre-computed. So you can create an expression sequence in a for loop. There are also some instances, like in Procedure.execute where an array of algebraics can be used in place of an expression sequence. Darin -- Kernel Developer Maplesoft
Convenient as it might be, I still suggest you don't write code assuming map order. It is like using any undocumented feature. We don't test the correctness or consistency of the map order, so we can't make guarantees that it is going to work across platforms, across versions or even from session to session. Darin -- Kernel Developer Maplesoft
As a note, one should not write code that depends on the order that map applies the function to the data. This is left unspecified on purpose. We may make changes and optimizations that effect the order and so your code may break. Darin -- Kernel Developer Maplesoft
Yes. Maple 9 was the first version to support OS X. Darin -- Kernel Developer Maplesoft
The editing policy described above clearly marks this experiment as not a wiki. A wiki allows users to update the content directly. What is a Wiki Wiki Design Principles I'd suggest that the site designers spend some time looking at other successful wikis. One of my favourites is the original wiki: Portland Pattern Repository Some important things to note: Anyone an edit any content at anytime. Comments are made as part of the editable text. This means users can make changes to other users comments as well as the main text. When good information is presented in "comments" it can be merged into the main section of the page and the comments removed. This current system seems a lot like blogs with hyperlinks, which is not all that different than what we had before. Also, why a travel wiki? Wouldn't it make more sense to have a wiki about Maple? I mean the whole point of this site is to build a community of Maple Users. Darin -- Kernel Developer Maplesoft
If you want to make your homepage rank higher in searches for your name, put your name into the title of the main page of your homepage. When I was working on getting my homepage ranking higher for searches on my name, including my name in the title seemed to make a big difference. Actually this is something that MaplePrimes might want to do. Adding "help" to the title of the main mapleprime page would probably improve mapleprimes ranking in searches for "maple help". Darin -- Kernel Developer Maplesoft
None of those search terms involve the word "help". If I'm a someone having a problem with maple I'm going to look for maple help. Also, a search for just Maple brings up the maplesoft website #1, but mapleprimes is not on the first page. I searched for "Maple Tips", which is a term you listed, the mapleprimes site did not show up until about 17 or 18. That's not first page either. What happens when the site is not longer Beta? How long does it take for the new pages to be ranked? As well, now that MaplePrimes is a user community I think lots more links from the maplesoft.com site to MaplePrimes.com would help drive up visitors. The maplesoft.com "community" link does not lead people to mapleprimes. mapleprimes is listed on the drop down menu on the resources button, but it does not appear on the resources page. Darin -- Kernel Developer Maplesoft
I think the best way to increase web traffic is to make the mapleprimes site rank highly for common search engine queries involving Maple. A google search for "maple help" has 3 university's local Maple help sites ranking above the Maplesoft Student Center. The rest of the first page is all other local help sites. If we can get most obvious Maple help related queries to return Mapleprimes as the first hit, I think the site will gain a lot of traffic. Given that there does not appear to be much competition I think this would be easy enough to do. It will, however, be difficult to do this without first making the beta site the offical site. If we want the search engines to rank mapleprimes by september, I'd suggest making this change as soon as possible. I like the idea of having a wiki content, although I think that won't help as much until the community has grown. i.e. when it becomes clear the forums need an FAQ, implement the FAQ via wiki and let it develop from there. I think a content rating system for a tips section (like on www.vim.org) would be a great idea. I'm not sure what you mean by user rating, but I think that having users rank other users is a bad idea. If we had comment rankings, then user rankings based on comment ranking might make sense. Darin -- Kernel Developer Maplesoft
1 2 3 4 5 6 Page 5 of 6