I assume you are using arduino-esp32 v2.0.2. If you choose the "ESP32 Wrover module" board, PSRAM will be automatically enabled. If you choose the "ESP32 Wrover Kit (all versions)", there is an option in the board menu to enable PSRAM. The memory will be initialized automatically as part of the initArduino() function.
PSRAM is used automatically for allocations greater than 16K bytes. If you want to ensure a smaller allocation uses psram, use the ps_malloc function (which behaves like a normal malloc).
I have posted an example that shows how to use a custom allocator to assign a std:: object (eg std::vector) into the psram.
https://github.com/lbernstone/psram_custom_allocator/