BNLNPPS / esi-shell

Apache License 2.0
0 stars 0 forks source link

Bash utilities for opticks cannot find proper paths #58

Closed rahmans1 closed 3 months ago

rahmans1 commented 5 months ago

Steps to reproduce the issue:

export OPTIX_DIR=/usr/local/optix
curl -Os https://bnlnpps.github.io/esi-shell/esi-shell && chmod u+x esi-shell
./esi-shell -v 1.0.0-beta.6

opticks-full

Then use test a bash utility from opticks

g4-;g4-cls G4Cerenkov

Error Message

root@579a2b0ce636:/esi/opticks# g4-;g4-cls G4Cerenkov
bash: cd: /opt/spack/opt/spack/linux-ubuntu22.04-sapphirerapids/gcc-11.4.0/geant4-11.1.2-z4zrvgbct5pf2uhyrxf7xlo5mjalfiwf/..build/geant4.10.04.p02/: No such file or directory
/esi/opticks
find: 'source': No such file or directory
find: 'source': No such file or directory
find: 'source': No such file or directory
find: 'source': No such file or directory
find: 'source': No such file or directory
vi -R
bash: vi: command not found

Probable cause

The utility is inside the externals folder and sets the paths through shell commands.

root@579a2b0ce636:/esi/opticks# ls externals
asiozmq.bash    g4.bash        nljson.bash       optix7c.bash
assimp.bash g4dae.bash     ocmake.bash       optix7sdk.bash
bcm.bash    g4dev.bash     ocsgbsp.bash      optixnote.bash
boost.bash  g4oktest.bash  odcs.bash         owl.bash
clhep.bash  glad.bash      oimplicitmesher.bash  oyoctogl.bash
cub.bash    gleq.bash      oof.bash          plog.bash
cuda.bash   glew.bash      openmesh.bash         rcs.bash
cudalin.bash    glfw.bash      opticksaux.bash       root.bash
cudamac.bash    glm.bash       opticksdata.bash      thrust.bash
denoise.bash    imgui.bash     optix.bash        xercesc.bash
externals.bash  mgpu.bash      optix7.bash       zmq.bash
g4-cls(){  
   local iwd=$PWD
   g4-cd 
   pwd
   g4-cls- source    $* ; 
   cd $iwd
}
g4-cls-(){
   local base=${1:-source}
   local name=${2:-G4OpBoundaryProcess}

   local h=$(find $base -name "$name.h")
   local hh=$(find $base -name "$name.hh")
   local cc=$(find $base -name "$name.cc")
   local icc=$(find $base -name "$name.icc")
   local src=$(find $base -name "$name.src")

   local cc2=""
   if [ "$name" == "G4SteppingManager" ] ; then
       cc2=$(find $base -name "${name}2.cc")
   fi  

   local vcmd="vi -R $h $hh $icc $cc $src $cc2"
   echo $vcmd
   eval $vcmd
}
plexoos commented 5 months ago

What is this command g4-cls G4Cerenkov supposed to do?

rahmans1 commented 5 months ago

What is this command g4-cls G4Cerenkov supposed to do?

It's a command line utility that's supposed to show the class description. May be they are not activated by default since they fall under the category of foreign externals. https://simoncblyth.bitbucket.io/opticks/docs/externals.html

plexoos commented 5 months ago

Do I understand correctly that G4Cerenkov is a Geant4 class? If so, here is the reference API https://geant4.kek.jp/Reference/11.1.2/classG4Cerenkov.html

It appears to me that g4-cls is broken because geant4 is not installed in /usr/local/opticks_externals

$ g4-cls
bash: cd: /usr/local/opticks_externals/g4_1042.build/geant4.10.04.p02/: No such file or directory
/home/dmitri
find: 'source': No such file or directory
find: 'source': No such file or directory
find: 'source': No such file or directory
find: 'source': No such file or directory
find: 'source': No such file or directory
vi -R
bash: vi: command not found

Geant4 is installed via Spack:

$ spack find -p geant4
-- linux-ubuntu22.04-sapphirerapids / gcc@11.4.0 ----------------
geant4@11.1.2  /opt/spack/opt/spack/linux-ubuntu22.04-sapphirerapids/gcc-11.4.0/geant4-11.1.2-z4zrvgbct5pf2uhyrxf7xlo5mjalfiwf
==> 1 installed package
rahmans1 commented 5 months ago

Do I understand correctly that G4Cerenkov is a Geant4 class? If so, here is the reference API https://geant4.kek.jp/Reference/11.1.2/classG4Cerenkov.html

It appears to me that g4-cls is broken because geant4 is not installed in /usr/local/opticks_externals

$ g4-cls
bash: cd: /usr/local/opticks_externals/g4_1042.build/geant4.10.04.p02/: No such file or directory
/home/dmitri
find: 'source': No such file or directory
find: 'source': No such file or directory
find: 'source': No such file or directory
find: 'source': No such file or directory
find: 'source': No such file or directory
vi -R
bash: vi: command not found

Geant4 is installed via Spack:

$ spack find -p geant4
-- linux-ubuntu22.04-sapphirerapids / gcc@11.4.0 ----------------
geant4@11.1.2  /opt/spack/opt/spack/linux-ubuntu22.04-sapphirerapids/gcc-11.4.0/geant4-11.1.2-z4zrvgbct5pf2uhyrxf7xlo5mjalfiwf
==> 1 installed package

Can opticks link against the geant4 installation that is available through spack?

plexoos commented 5 months ago

Yes, that is exactly where opticks finds Geant4 via CMake. In the container we simply don't have another instance of Geant4 besides the one installed with Spack

buddhasystem commented 5 months ago

But it's in the image, right?

plexoos commented 5 months ago

But it's in the image, right?

Yes, all the dependencies (including Geant4) opticks is compiled against are in the image.

rahmans1 commented 4 months ago

@plexoos Is there a work around for the bash utilities to work without geant4 being present in the externals folder?

plexoos commented 4 months ago

I don't think there is an easy workaround to make commands from g4.bash work as some of them expect the Geant's source directory. Currently, we don't keep the source files, but this default Spack's behavior can be changed.

rahmans1 commented 4 months ago

I don't think there is an easy workaround to make commands from g4.bash work as some of them expect the Geant's source directory. Currently, we don't keep the source files, but this default Spack's behavior can be changed.

In that case, I don't think this is a priority for us. We would just make a disclaimer that those external utilities don't work within esi-shell.

buddhasystem commented 4 months ago

The size of the G4 source is trivial. What's not trivial is scripting to add this... Doable, but as Sakib said probably not a priority.

plexoos commented 3 months ago

To summarize, the issue is about a feature in opticks to reference Geant4 classes (and related documentation). Since we don't have plans to support opticks, the users can use the official Geant4 documentation available elsewhere.