Difference between revisions of "ApCoCoA-1:HowTo:Run ApCoCoA on a Computing Server"

From ApCoCoAWiki
m (Bot: Replacing category HowTo with HowTo Old)
 
(10 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
==Introduction==
 
==Introduction==
This HowTo shows you how to run ApCoCoA on a Linux server with terminal.
+
This HowTo shows you how to run ApCoCoA on a Linux server at terminal.
  
  
 
==Prerequisites==
 
==Prerequisites==
* Download [[:ApCoCoA:Downloads#Well-known_Qt-GUI | ApCoCoA QT]] and unzip the file. (This HowTo takes ApCoCoA 1.9.0 as an example.)
+
* Download [[:ApCoCoA:Downloads#Well-known_Qt-GUI | ApCoCoA QT]] and unzip the file. This HowTo will take ApCoCoA 1.9.0 as an example.
 
  wget http://www.apcocoa.org/download/apcocoa/linux-x86_64/apcocoa-1.9.0-QT-linux-x86_64.tgz
 
  wget http://www.apcocoa.org/download/apcocoa/linux-x86_64/apcocoa-1.9.0-QT-linux-x86_64.tgz
 
  tar xzvf apcocoa-1.9.0-QT-linux-x86_64.tgz
 
  tar xzvf apcocoa-1.9.0-QT-linux-x86_64.tgz
* Recommend to use a tool like "screen" (http://www.gnu.org/software/screen/screen.html) or "tmux" (http://tmux.sourceforge.net/) which allows you to run apcocoa(server) in the background, so that you can log off from the terminal session without having to stop the program.
+
* We recommend to use a tool like "screen" (http://www.gnu.org/software/screen/screen.html) or "tmux" (http://tmux.sourceforge.net/) which allows you to run apcocoa(server) in the background, so that you can log off from the terminal session without having to stop the program.
  
 +
==Run ApCoCoA==
 +
 +
===ApCoCoA with Text Interface===
 +
Go to the folder ApCoCoA-1.9.0. The contents in the folder are as follows. In the following, assume that you are working at the directory ApCoCoA-1.9.0/.
  
==Run ApCoCoA==
+
[[Image:ApCoCoA_files.jpg]]
Go to the folder ApCoCoA-1.9.0. The contents in the folder are as follows.
 
-rwxr-xr-x 1 xiu users  4283296 17. Mai 13:11 ApCoCoABBFServer
 
-rwxr-xr-x 1 xiu users  6461552 17. Mai 13:05 ApCoCoAQt
 
-rwxr-xr-x 1 xiu users 11324912 17. Mai 13:11 ApCoCoAServer
 
drwxr-xr-x 3 xiu users    4096 17. Mai 13:11 Bertini
 
drwxr-xr-x 3 xiu users    4096 17. Mai 13:11 Glpk
 
drwxr-xr-x 5 xiu users    4096 17. Mai 13:11 Hom4ps
 
-rw-r--r-- 1 xiu users    32422 17. Mai 13:11 LICENSE
 
drwxr-xr-x 3 xiu users    4096 17. Mai 13:11 Latte
 
-rw-r--r-- 1 xiu users    14300 17. Mai 13:11 README
 
-rwxr-xr-x 1 xiu users    2394 17. Mai 13:05 apcocoa
 
-rwxr-xr-x 1 xiu users  637708 17. Mai 13:05 apcocoa_text
 
drwxr-xr-x 7 xiu users    4096 17. Mai 13:11 doc
 
drwxr-xr-x 2 xiu users    4096 17. Mai 13:05 emacs
 
drwxr-xr-x 3 xiu users    4096 17. Mai 13:11 gnuplot
 
drwxr-xr-x 6 xiu users    4096 17. Mai 13:11 packages
 
drwxr-xr-x 3 xiu users    4096 17. Mai 13:11 sat
 
drwxr-xr-x 2 xiu users    4096 17. Mai 13:11 temp
 
-rw-r--r-- 1 xiu users      250 17. Mai 13:05 userinit.coc
 
-rw-r--r-- 1 xiu users    8477 17. Mai 13:11 wordlist.txt
 
-rwxr-xr-x 1 xiu users    3429 17. Mai 13:05 xapcocoa
 
In the following, we shall always assume that we are working at the directory ApCoCoA-1.9.0/.
 
  
===ApCoCoA with text Interface===
 
 
Run the following command at terminal to start the ApCoCoA text interface.
 
Run the following command at terminal to start the ApCoCoA text interface.
 
  ./apcocoa_text
 
  ./apcocoa_text
Line 43: Line 24:
  
 
[[Image:ApCoCoA_text1.jpg]]
 
[[Image:ApCoCoA_text1.jpg]]
 +
  
 
===ApCoCoAServer===
 
===ApCoCoAServer===
In many cases you also need to run the ApCoCoAServer. Here, we assume that you have some terminal tools, like "screen", "tmux", etc., to create new terminal sessions, and that you are able to switch between terminal sessions without having to stop the running program.
+
In many cases you also need to run the ApCoCoAServer. Here, assume that you have some terminal tools, like "screen", "tmux", etc., to create new terminal sessions, and that you are able to switch between terminal sessions without stopping the running program.
  
 
Create a new terminal session for the ApCoCoAServer and run the following command to start the ApCoCoAServer.
 
Create a new terminal session for the ApCoCoAServer and run the following command to start the ApCoCoAServer.
Line 52: Line 34:
 
[[Image:ApCoCoA_Server0.jpg]]
 
[[Image:ApCoCoA_Server0.jpg]]
  
Observe that the ApCoCoAServer is running on the default port 49344 (0xc0c0). One can change the port number to n by using option -p as follows.
+
Observe that the ApCoCoAServer is running on the default port 49344 (0xc0c0). You can run the ApCoCoAServer on another port by using option -p as follows.
  ./ApCoCoAServer -p n
+
  ./ApCoCoAServer -p N
 +
where N is the port number. Then, you can use the following command in ApCoCoA text interface to specify which ApCoCoAServer you want to use.
 +
MEMORY.ApCoCoAServerPort:="0xHHHH";
 +
where 0xHHHH is the hexadecimal form of the port number N we set previously.
 +
 
 +
Now let us switch to the terminal session for the ApCoCoA text interface again. Execute the following commands.
 +
X:="xy";
 +
M:=["xxx","yxy","xyx"];
 +
NCo.IsFinite(X, M); -- Check whether <x,y>/<x^3,yxy,xyx> is finite
 +
The function NCo.IsFinite uses the ApCoCoAServer. You will get the following result in the ApCoCoA text interface.
 +
 
 +
[[Image:ApCoCoA_text2.jpg]]
 +
 
 +
And you can see the following message in the terminal session for the ApCoCoAServer.
  
Now let us go to ApCoCoA test interface again, and run the following example.
+
[[Image:ApCoCoA_Server1.jpg]]
  
 +
===ApCoCoA Program Files===
 +
Sometimes it is useful to write commands or functions in ApCoCoA program files. For example, we define a function for computing Fibonacci numbers as follows.
 +
Define Fib(N)
 +
  If N<=1 Then
 +
    Return 0;
 +
  Elif N=2 Then
 +
    Return 1;
 +
  Else
 +
    Return Fib(N-2)+Fib(N-1);
 +
  EndIf;
 +
EndDefine;
 +
In order to load this function to ApCoCoA, we write the function in an ApCoCoA program file, say test.coc, in the directory ApCoCoA-1.9.0/. Then, using the following command, we run ApCoCoA which processes the file test.coc as a batch file. Then, we can use the function Fib(N) to compute Fibonacci numbers in ApCoCoA.
 +
./apcocoa test.coc
  
 +
[[Image:ApCoCoA_text3.jpg]]
  
 +
Note that, before running apcocoa, you may have to check that if APCOCOA_PREFIX is set properly. APCOCOA_PREFIX is the directory for your ApCoCoA, and it is set in the file apcoca in the directory ApCoCoA-1.9.0/. You can use an edit tool to edit it.
  
 +
[[Image:ApCoCoA_prefix.jpg]]
  
[[Category:HowTo|{{PAGENAME}}]]
+
[[Category:HowTo Old]]

Latest revision as of 09:43, 29 October 2020

Introduction

This HowTo shows you how to run ApCoCoA on a Linux server at terminal.


Prerequisites

  • Download ApCoCoA QT and unzip the file. This HowTo will take ApCoCoA 1.9.0 as an example.
wget http://www.apcocoa.org/download/apcocoa/linux-x86_64/apcocoa-1.9.0-QT-linux-x86_64.tgz
tar xzvf apcocoa-1.9.0-QT-linux-x86_64.tgz

Run ApCoCoA

ApCoCoA with Text Interface

Go to the folder ApCoCoA-1.9.0. The contents in the folder are as follows. In the following, assume that you are working at the directory ApCoCoA-1.9.0/.

ApCoCoA files.jpg

Run the following command at terminal to start the ApCoCoA text interface.

./apcocoa_text

ApCoCoA text.jpg

You can run any (Ap)CoCoA command in this interface.

ApCoCoA text1.jpg


ApCoCoAServer

In many cases you also need to run the ApCoCoAServer. Here, assume that you have some terminal tools, like "screen", "tmux", etc., to create new terminal sessions, and that you are able to switch between terminal sessions without stopping the running program.

Create a new terminal session for the ApCoCoAServer and run the following command to start the ApCoCoAServer.

./ApCoCoAServer

ApCoCoA Server0.jpg

Observe that the ApCoCoAServer is running on the default port 49344 (0xc0c0). You can run the ApCoCoAServer on another port by using option -p as follows.

./ApCoCoAServer -p N

where N is the port number. Then, you can use the following command in ApCoCoA text interface to specify which ApCoCoAServer you want to use.

MEMORY.ApCoCoAServerPort:="0xHHHH";

where 0xHHHH is the hexadecimal form of the port number N we set previously.

Now let us switch to the terminal session for the ApCoCoA text interface again. Execute the following commands.

X:="xy";
M:=["xxx","yxy","xyx"];
NCo.IsFinite(X, M); -- Check whether <x,y>/<x^3,yxy,xyx> is finite

The function NCo.IsFinite uses the ApCoCoAServer. You will get the following result in the ApCoCoA text interface.

ApCoCoA text2.jpg

And you can see the following message in the terminal session for the ApCoCoAServer.

ApCoCoA Server1.jpg

ApCoCoA Program Files

Sometimes it is useful to write commands or functions in ApCoCoA program files. For example, we define a function for computing Fibonacci numbers as follows.

Define Fib(N)
  If N<=1 Then
    Return 0;
  Elif N=2 Then
    Return 1;
  Else
    Return Fib(N-2)+Fib(N-1);
  EndIf;
EndDefine;

In order to load this function to ApCoCoA, we write the function in an ApCoCoA program file, say test.coc, in the directory ApCoCoA-1.9.0/. Then, using the following command, we run ApCoCoA which processes the file test.coc as a batch file. Then, we can use the function Fib(N) to compute Fibonacci numbers in ApCoCoA.

./apcocoa test.coc

ApCoCoA text3.jpg

Note that, before running apcocoa, you may have to check that if APCOCOA_PREFIX is set properly. APCOCOA_PREFIX is the directory for your ApCoCoA, and it is set in the file apcoca in the directory ApCoCoA-1.9.0/. You can use an edit tool to edit it.

ApCoCoA prefix.jpg