# Environment

You are running on a cluster called SCRP.

## Documentation

The documentation of the cluster can be found on:
https://scrp.econ.cuhk.edu.hk/

## Slurm

The cluster uses the Slurm system to allocate resource. 
When you try to run code written in Python, Julia, Stata, R or MATLAB, use the srun command to allocate
resource. For example, instead of

python my_code.py

Use

srun -c 4 -I python my_code.py

- If the user have specific resource request, such as the number of CPU cores, 
the usual srun commmand line options are available. 
- The default should be 4 CPU cores, as the example has requested.
- If requesting more than 32 CPU cores with no GPUs, use the '-p large' option.

GPUs on the cluster are available in two partitions:
- gpu: this partition provide access to RTX 3060 12GB and RTX 3090 24GB GPUs.
- a100: this partition provide access to A100 GPUs. Only use this partition if the user specifically
request them.

Use the following syntax for GPU request:

srun -c 4 --mem=12G -I -p {partition} --gpus={gpu_model}

where {partition} can be one of the following: gpu, a100
and {gpus_model} can be one of the following: rtx3060, rtx3090, a100

When requesting a GPU, unless the user specify otherwise, use the following srun settings:
- Request as much main memory as the GPU's VRAM by using srun's --mem option.
- For A100 GPUs, request 16 CPU cores instead of 4.

If the user requests you to run the code detached, you can use the sbatch command to do so, by first writing
a batch script.

There are several help additional helper functions:
- scrp-info for the status of the cluster's compute nodes.
- qos for the user's Slurm quality of service level.

## Python

There are four existing conda environments:
- base: use this environment for code that does not involve neural network. 
- pytorch
- tensorflow
- rapids: use this environment when you need rapids.ai modules, such as cuML or cuDF.

The user may have more conda environments. Activate and use them if the user requires you to do so. 

You can also suggests to the user the creation of new conda environments if the code does not run due
to missing dependencies.

## Analytical and Statistical Software

### Stata

- Stata is available with the command stata-mp.
- If you need the documentation for a Stata command, fetch https://www.stata.com/help.cgi?{command}
- If you need to search for a topic related to Stata usage, use fetch https://www.stata.com/search.cgi?query={topic}

### Other Software

R, MATLAB, Julia are also available with their usual commands.

## Web Access

You have access to both non-browser-based and browser-based web access.
Always respect the user's preference on which method to use.
If the user does not specific what to use, use the most appropriate method of access
based on your judgement.

If you need browser-based web access, use playwright-cli.
Check playwright-cli --help for available commands.

## Web search

Use the searx cli command to search the web.
Check searx --help for options.

## Vision Capability

A vision model capable of describing and transcribing images is available with 
the following shell command:

scrp-vision {instruction} {image_1} {image_2} ...

The command supports up to three image file paths, URLs, PDFs, or base64 encoded strings 
and answers according to your instruction.

## Image Generation and Editing

You can use the following shell command for image generation and editing:

scrp-image {instruction} [{image}]

- If no image is provided, the command saves a generated image.
- If an image is provided, the command saves the edited image instead.

The command saves the image to the current directory.

## PDF Processing

You have the ability to process a PDF file with a vision model, scrp-vision,
or by text alone, with pdftotext.
scrp-vision is more detailed, but pdftotext is much faster.

Always respect the user's stated preference. If the user asks you to use a vision
model, use scrp-vision regardless of page count and document count.

If the user does not state a preference, check first if the total number of pages 
you need to process from all PDFs exceed 8 with pdfinfo.
- If the number of pages is larger than 8, use pdftotext.
- If the number of pages is smaller or equal to 8, 
  use the scrp-vision command to transcribe it.
  If this process fails, fall back to other methods such as pdftotext.
Inform the user of your choice and proceed to processing.

## Default File Format for Output

When you need to save generated content to file,
such as solution to mathematics or assignments, output of statistical analysis,
or generally any written report,
you should generate a PDF file based on tex, unless the user request otherwise.
Equations must be typeset professionally in tex syntax in reports.

## Presentation of Analytical Results

When presenting results from regression analysis, please present it in a table
with the left-most column being the names of the independent variables, and each
subsequent column the coefficients from one regression model. Report standard
errors brackets below their corresponding coefficients. Keep two significant figures.
P-values should be reported with asterisks next to their corresponding coefficients, 
with * representing p < 0.05 and ** representing p < 0.01.

When presenting summary statistics, report in a table with each row representing
one variable. Report the number of non-missing observations, mean, standard 
deviation, minimum and maximum value.

## Charts and Diagrams Output

Always generate charts and diagrams with code and never with text output alone.