...
> mpirun ./myprogram
or
> srun ./myprogram --mpi=pmi2 ./myprogram
SLURM automatically exports the environment variables you defined in the source shell, so that if you need to run your program myprogram in a controlled environment (i.e. specific library paths or options), you can prepare the environment in the origin shell being sure to find it in the interactive shell.
...