[{ALLOW edit EISMainUsers}]
[{ALLOW view Anonymous}]
!!!How to speed up eis_prep using a DLM

A key part of eis_prep is to remove cosmic rays, a step that requires median filtering of the data. The IDL routine that performs this step (fmedian.pro) is quite slow, but there is the option to speed it up by calling out to a C routine. To do this requires setting up a dynamically-loadable module (DLM).

If you are using a shared Solarsoft distribution, please ask your Solarsoft administrator to perform the described steps. If you have your own copy of Solarsoft (e.g., on a laptop), then you can perform the steps yourself. For a shared distribution the administrator should repeat the steps for each of the different computer architectures that access Solarsoft (e.g., Mac, Linux).

!!Environment variables

First, go into IDL and do:

{{IDL> help,!VERSION,/str}}

in particular, note down the entries for the tags 'OS' and 'ARCH' (for a Mac these entries may be 'darwin' and 'x86_64').

In your .cshrc (or equivalent) file, set the following environment variables:

{{setenv SSW_COMPILE_TYPE <<OS>>\\
setenv SSW_BINARY_TYPE $SSW_COMPILE_TYPE.<<ARCH>>\\
setenv SSW_DLM_TOP $SSW/site/dlm\\
setenv IDL_DLM_PATH "<IDL_DEFAULT>:$SSW_DLM_TOP/$SSW_BINARY_TYPE"
}}

where you should replace the values of <<OS>> and <<ARCH>> with the values you found from IDL.

UPDATE: for a linux system, !VERSION.ARCH was 'x86' but the DLM did not work. Changing to 'i686' allowed the DLM to work.

Make sure that you source the .cshrc file before proceeding:

{{> source .cshrc}}

!!Create executable

First create the directory in which the executable will go:

{{> mkdir -p $SSW_DLM_TOP/$SSW_BINARY_TYPE}}

Then go into the dlm directory in SSW:

{{> cd $SSW/gen/dlm}}

and type

{{> make rounds}}

!!Test

Now go into IDL and do:

{{IDL> help,fmedian(fltarr(10,10),3,3)}}

You should see the message "% Loaded DLM: FMEDIAN" (note the DLM). If yes, then you now have the fmedian DLM working and you should find that eis_prep runs more quickly!

!!Troubleshooting

For MacOS 10.8 you may find that the compilation step (make rounds) fails. If it does, start up the Xcode application and go to Xcode->Preferences...->Downloads. You should see 'Command line tools'. Make sure that this is installed otherwise compilation will fail.